This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Convert text representing number in base N to decimal number


d = base2dec('strn', base)


d = base2dec('strn', base) converts strn, text representing a number in the base specified by base, into its decimal (base 10) equivalent. base must be an integer between 2 and 36. strn must represent a nonnegative integer value. If strn represents an integer value greater than the value returned by flintmax, then base2dec might not return an exact conversion.

strn can be a character array, a cell array of character vectors, or a string column vector. If strn is a character array, then each row represents a number in the base specified by base. If strn is a cell array of character vectors or a string column vector, then each element represents a number in the base specified by base.


The expression base2dec('212',3) converts 2123 to decimal, returning 23.