IEEE 754 32 bit floating point single precision

조회 수: 43 (최근 30일)
Sudharsan
Sudharsan 2013년 9월 7일
댓글: Diego Garrido-Mendoza 2022년 1월 17일
I have a matrix with decimal values.
say:
a=[43 75 23;85 34 78;13 78 23]
i want to convert all the values to 32-bit single precision floating point value IEEE 754 format. Can anybody help me...
or just take a=240;
i want to get "01000011011100000000000000000000"
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 9월 7일
Not enough bits there. 32 bits is 4 bytes, but you have given a 3 x 3 matrix.
Deepanshu Chauhan
Deepanshu Chauhan 2020년 8월 27일
here is a video "https://youtu.be/kSv2bIFS0XU"

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2013년 9월 7일
편집: Walter Roberson 2013년 9월 7일
t = uint8(a .');
typecast( t(:), 'single')
and then reshape the result as appropriate.
Be sure to check the byte order against the other possibilities.
  댓글 수: 2
Sudharsan
Sudharsan 2013년 9월 7일
it is showing the following error.
Expression or statement is incorrect--possibly unbalanced (, {, or [.
Walter Roberson
Walter Roberson 2013년 9월 7일
Fixed now. I don't know how the extra comma got in there.

댓글을 달려면 로그인하십시오.


Jan
Jan 2013년 9월 8일
This shows the bit pattern of 240 represented as single precision float:
dec2bin(typecast(single(240), 'uint8'))

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by