how to implement in matlab

2 visualizaciones (últimos 30 días)
Pooja
Pooja el 7 de Ag. de 2013
Editada: Walter Roberson el 24 de En. de 2017
n=1011(binary) 11 in decimal and b= 3(decimal) and finally getting answer as 011(binary). the b LSB of n to produce the subexponential code of n. How to implement it in matlab?
n=1011 b=3 z=1|011 ans=011

Respuesta aceptada

dpb
dpb el 7 de Ag. de 2013
Editada: dpb el 7 de Ag. de 2013
Ohh....I think I finally figured out what want--the (variable) number of LSB(its) of the input value...ok, if interpretation is correct.
r=bitand(n, bin2dec(repmat('1',1,b))); % value
r=dec2bin(bitand(n, bin2dec(repmat('1',1,b))),b); % bit representation
Use whatever integer is appropriate for the problem space; Matlab will work on default doubles if all are integers.
  25 comentarios
Pooja
Pooja el 12 de Ag. de 2013
I think i am not able to make out the question.I have stored the output of the encoded binary stream as save temp.txt .And for decoding i am calling as load temp.txt.
dpb
dpb el 12 de Ag. de 2013
Editada: dpb el 15 de Ag. de 2013
I think i am not able to make out the question...
Clearly. We've had this problem from the very first question that I can't seem to get across to you the difference between internal representation and the conceptualization of what that representation means.
And the underlying issue is that whatever bits you calculate if they're stored in anything except a sequence of only that number of bits are then irretrievable as to which are/aren't actually data in the larger entity when the code length they represent isn't a fixed length.
So, instead of trying to explain verbally show some source code. It will have a precise meaning in a common language...from that starting point maybe we can finally reach a mutual understanding.
Post your Matlab code that does the calculation of the coding and the write...it can be the few lines needed to read in or generate an input array, the call of the coder that returns the encoded result and the subsequent write/save to the file. That should be able to be brought down to a half-dozen lines or so at most I'd think.
Then, for completeness show the encoding routine and the line or two necessary to read the file. Wouldn't hurt to add the first few lines (3 or 4, say) of the file as well.
I'm pretty sure this will show that you're saving each encoded result in an array element, either an integer or default double, in which case you have the problem I've outlined above.
Do you understand the comment I made time stamped 11 Aug 2013 at 15:50? In particular, do you understand the implications of the sentence from the paper quoted there? If not, we've got a hurdle to get you over to see why there's a problem here.
I'll repeat it here for a reminder--
... p. 26, the middle paragraph below the numbered steps of how to generate the code. Note carefully the penultimate sentence of that paragraph--
"Finally, the length of the produced code must be computed in order to properly transfer the coded value to the next stage." (emphasis added)
It's that length that isn't available if the data are passed as individual array elements--then they're all the length of the (internal) storage unit and the length of the code stored in the array element is unknown. Hence we (as the decoder) don't know and can't tell which is the first encoded bit within all the bits of the array element.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by