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

3 vues (au cours des 30 derniers jours)
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 commentaires
Mohamuud hassan
Mohamuud hassan le 19 Mai 2015
Modifié(e) : Mohamuud hassan le 19 Mai 2015
thank you Guillaume
this is what i have done before,and my question is how i can recover the original, means Stream vector digits from Nmmestrean vector, if i dont have the size of Stream.
Stream='00000100100101011110010111111100110100111100110100000001000000101101111010011010100101010100011100111111010111101001000011001011111011111000000000';
NmmewRstream=Stream;
gnumber=12;
if(mod(length(Stream),12)~=0)
h_nearst=floor(length(Stream)/gnumber);
g_appbi=(h_nearst+1)*gnumber-length(Stream);
for hg=1:g_appbi
NmmewRstream=strcat(NmmewRstream,'0');
end
end
John D'Errico
John D'Errico le 19 Mai 2015
You are not listening. You cannot do so. Impossible is impossible.

Connectez-vous pour commenter.

Réponse acceptée

John D'Errico
John D'Errico le 19 Mai 2015
Modifié(e) : John D'Errico le 19 Mai 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.

Plus de réponses (1)

Jan
Jan le 19 Mai 2015
Modifié(e) : Jan le 19 Mai 2015
You can't, obviously. If you append data and do not store anywhere the number of added data, there is no chance to obtain this information anymore.
The solution is to store the number of original bits separately.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by