Convert the hexadecimal representation of a binary double-precision number back into a double

1 visualización (últimos 30 días)
How can I convert a double-precision hexadecimal back into a double?
That is, given s, created from the double x as such:
s = sprintf('%bx',x)
How can I recover x?

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 3 de Nov. de 2011
>> x=rand
x =
0.126986816293506
>> s = sprintf('%bx',x)
s =
3fc0411a9f807b7c
>> y=hex2num(s)
y =
0.126986816293506

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by