# how i can again get the original digits,without knowing the length of the original digits.

1 view (last 30 days)

Show older comments

Mohamuud hassan
on 19 May 2015

Edited: John D'Errico
on 19 May 2015

##### 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

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!