num2hex
Convert single- and double-precision numbers to IEEE hexadecimal format
Syntax
Description
hexStr = num2hex(
returns a representation
of X
)X
in IEEE® format using hexadecimal digits.
If
X
is a double-precision number, thenhexStr
has 16 characters.If
X
is a single-precision number, thenhexStr
has 8 characters.If
X
is a vector, matrix, or multidimensional array, thenhexStr
is a two-dimensional character array. Each row ofhexStr
represents an element ofX
.
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.
Examples
Input Arguments
Extended Capabilities
Version History
Introduced before R2006a