base2dec
Convert text representing number in base N to decimal number
Syntax
d = base2dec('
strn
', base)
Description
d = base2dec('
convertsstrn
', base)strn
, text representing a number in the base specified bybase
, into its decimal (base 10) equivalent.base
must be an integer between 2 and 36.strn
must represent a nonnegative integer value. Ifstrn
represents an integer value greater than the value returned byflintmax
, thenbase2dec
might not return an exact conversion.
strn
can be a character array, a cell array of character vectors, or a string column vector. Ifstrn
is a character array, then each row represents a number in the base specified bybase
. Ifstrn
is a cell array of character vectors or a string column vector, then each element represents a number in the base specified bybase
.
Examples
The expressionbase2dec('212',3)
converts 2123to decimal, returning 23.