Decimal to Base-N Conversion in MATLAB
Advertisement
This page provides MATLAB source code for converting a decimal number to a base-N number string. This functionality is similar to the dec2base MATLAB function. The dec2base function converts a decimal integer to a string representation in a specified base ‘b’.
MATLAB Code Example: dec2base Functionality
>> output = dec2base(25, 3)
output =
'221'
In this example, the decimal number 25 is converted to its base-3 representation, resulting in the string ‘221’.
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
