Convert single- and double-precision numbers to IEEE hexadecimal format
hexStr = num2hex(
returns a representation
of X
)X
in IEEE® format using hexadecimal digits.
If X
is a double-precision number, then hexStr
has 16 characters.
If X
is a single-precision number, then hexStr
has 8 characters.
If X
is a vector, matrix, or multidimensional array, then
hexStr
is a two-dimensional character array. Each row of
hexStr
represents an element of X
.
Unlike the dec2hex
function, num2hex
can
convert floating-point values with fractional parts. Also, num2hex
handles NaN
and Inf
values and denormal numbers
correctly.
The format produced by num2hex
is identical to the one produced by
the format hex
command.