Skip to Main Content Skip to Search
Product Documentation

hex2num - Convert hexadecimal number string to double-precision number

Syntax

n = hex2num(S)

Description

n = hex2num(S), where S is a 16 character string representing a hexadecimal number, returns the IEEE® double-precision floating-point number n that it represents. Fewer than 16 characters are padded on the right with zeros. If S is a character array, each row is interpreted as a double-precision number.

NaNs, infinities and denorms are handled correctly.

Examples

hex2num('400921fb54442d18')

returns Pi.

hex2num('bff') 

returns

ans =

    -1

See Also

format | hex2dec | num2hex | sprintf

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS