IEEE 754 32 bit floating point single precision
58 ビュー (過去 30 日間)
古いコメントを表示
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
2013 年 9 月 7 日
Not enough bits there. 32 bits is 4 bytes, but you have given a 3 x 3 matrix.
回答 (2 件)
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 件のコメント
Jan
2013 年 9 月 8 日
This shows the bit pattern of 240 represented as single precision float:
dec2bin(typecast(single(240), 'uint8'))
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!