Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

hex2dec

Convert hexadecimal number string to decimal number

Syntax

d = hex2dec('hex_value')

Description

d = hex2dec('hex_value') converts hex_value to its floating-point integer representation. The argument hex_value is a hexadecimal integer stored in a MATLAB® string or cell array of strings. If the value of hex_value is greater than hexadecimal 10,000,000,000,000, hex2dec might not return an exact conversion.

If hex_value is a cell array of strings, each row is interpreted as a hexadecimal string.

Examples

hex2dec('3ff')

ans =

        1023

For a character array S,

S =
0FF
2DE
123
hex2dec(S)

ans =

255
734
291
Was this topic helpful?