how i can again get the original digits,without knowing the length of the original digits.
3 views (last 30 days)
Show older comments
Mohamuud hassan
on 19 May 2015
Edited: John D'Errico
on 19 May 2015
hello all my friends, i was using mod for grouping binary data in multiple groups according to mod 12. the size of my original data was 146 digits, when i applied mod 12 i obtained 13 groups and each group contains 12 elements by appending extra zeros when there is a remainder, 146 digits mod 12 there will remainder which are 2 digits and i completed by adding 10 extra zeros to obtain 13'th group which means 156 digits. so how i can again get the original digits,without knowing the length of the original digits.
3 Comments
Accepted Answer
John D'Errico
on 19 May 2015
Edited: John D'Errico
on 19 May 2015
I'm sorry, but you cannot do so.
You have added data. From your description, you started with a string of digits, some of which MAY have been zero. You did not say that was NOT a possibility.
Then you appended some number of zeros. We don't know how many, and they may be touching other zeros that were already in the list. So unless you kept some record of the number of zeros that were padded on, you cannot know how many were padded and how many were already there.
There is no magic. You can sometimes guess correctly by looking at the number of trailing zeros, but there will be some times when your guess will be wrong.
I think the trick here is, suppose you STARTED with a bit string of length 146, then appended 10 zeros.
Alternatively, suppose you started with the 156 long bit string as produced above? Here, no padding was necessary, and the result is IDENTICAL to the first case.
Just looking at the final result, you cannot recover what you started with. Suppose there was a third case? Here I'll presume a string that lacks ANY trailing zeros. In that case, obviously no zero padding was done, so you have no problems. But if there are trailing zeros, they may have been padded or not.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!