baseN Number String to Decimal Conversion in MATLAB
Advertisement
This page provides MATLAB source code for converting a baseN number string to its decimal equivalent, essentially replicating the functionality of the base2dec function in MATLAB.
base2dec(str, b) is a MATLAB function that converts a string number str represented in base b into its decimal (base 10) equivalent.
Example:
output = base2dec('20', 3)
This would produce the following output:
output = 6
Because (2 3^1) + (0 _ 3^0) = 6.
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
