floating point to binary conversion

7 visualizaciones (últimos 30 días)
ashok
ashok el 28 de Abr. de 2014
Respondida: Walter Roberson el 28 de Abr. de 2014
if true
% code
if a =
-5932.62103114252
5931.17666698258
5797.34103035393
-6358.78042353988
-12430.1210180646
-9849.27324380255
-6386.88118380371
7783.15716000243
5177.38696737792
6082.47763148202
-4816.43707738488...........
end
how to convert this to binary? with out using uint8,16,64 i need the output in double
if i use uint the values are rounded off and i am not able to reconstruct (image) is there any possibilities to convert it.
because after converting it i need to modulate and transmit.

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Abr. de 2014
dec2bin(typecast(YourFloatingPointVector, 'uint64'), 64) - '0'

Más respuestas (1)

Image Analyst
Image Analyst el 28 de Abr. de 2014
I don't know what you mean. The image already is in double. What do you mean by "binary"? You mean binary like a binary image, where the pixels are true or false and the data type is logical? You can create that by thresholding and casting to double:
binaryImage = a < 1000; % Whatever value... binaryImage is of type "logical".
doubleImage = double(binaryImage); % Make double.
What are you talking about uint8, uint16, etc. Those aren't binary except in the sense that ALL numbers in a computer are binary. Maybe you want the dec2bin() function to turns numbers into strings of 0's and 1's.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by