MATLAB: How to show the 4-byte hex representation of a single precison float value

binaryhexMATLABsimulinksingle precision float

Is there a way to show/display the 4-byte hex and/or binary representation of a single precision float value in Matlab and/or Simulink?

Best Answer

s = your single float number
h = dec2hex(typecast(s,'uint32'),8)
And the reverse is
s = typecast(uint32(hex2dec(h)),'single')
If you want binary then see the dec2bin( ) and bin2dec( ) functions.