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.