floating point to binary conversion

조회 수: 11 (최근 30일)
ashok
ashok 2014년 4월 28일
답변: Walter Roberson 2014년 4월 28일
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.

채택된 답변

Walter Roberson
Walter Roberson 2014년 4월 28일
dec2bin(typecast(YourFloatingPointVector, 'uint64'), 64) - '0'

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 4월 28일
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.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by