matlab convert hexadecimal to decimal (hex2dec function)

hex2dec function

Converts the hexadecimal integer represented by hexStr to its decimal equivalent and returns it as a double-precision floating-point value.

If hexStr represents an integer greater than or equal to flintmax, hex2dec may not represent it exactly as a floating point value.

1. Example: Convert a character vector representing a hexadecimal value to a decimal number.

hexStr = '3FF';
D = hex2dec(hexStr)

Exit
D = 1023

2. Example: Return a numerical array

hexStr = ["3FF" "7A" "E"]
D = hex2dec(hexStr)

Output
D = 1×3

    1023         122          14

Guess you like

Origin blog.csdn.net/iii66yy/article/details/134095564