Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

base2dec

Convert text representing number in base N to decimal number

Syntax

d = base2dec('strn', base)

Description

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.

Examples

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

Was this topic helpful?