Hexadecimal to Decimal Conversion in MATLAB
Advertisement
This page provides MATLAB source code for hexadecimal to decimal conversion using the hex2dec function.
Function Definition:
output = hex2dec(input)
This MATLAB function converts a hexadecimal string to its decimal equivalent integer.
Example:
input = 'FFFF';
output = hex2dec(input)
output = 65535
Explanation:
The hex2dec function takes a string representing a hexadecimal number as input and returns its decimal representation as a numerical value. In the example above, the hexadecimal string ‘FFFF’ is converted to the decimal number 65535.
Explore MATLAB Data Types, Strings & Conversions
- Binary to Decimal Conversion in MATLAB
- Binary to Hex Conversion in MATLAB
- Decimal to Base-N Conversion in MATLAB
- Decimal to Binary Conversion in MATLAB
- Decimal to Hexadecimal Conversion in MATLAB (dec2hex)
- Hex to Binary Conversion in MATLAB
- Hexadecimal String to Double Conversion in MATLAB
- Number to Hexadecimal String Conversion in MATLAB
- Number to String Conversion in MATLAB (num2str)
- String to Double Conversion in MATLAB
- String to Number Conversion in MATLAB (str2num)
- MATLAB Matrix to String (mat2str)
- Base-N Number String to Decimal in MATLAB
