Documentation

base2dec

Convert text representing number in base N to decimal number

Syntax

d = base2dec('strn', base)

Description

d = base2dec('strn', base)convertsstrn, text representing a number in the base specified bybase, into its decimal (base 10) equivalent.basemust be an integer between 2 and 36.strnmust represent a nonnegative integer value. Ifstrnrepresents an integer value greater than the value returned byflintmax, thenbase2decmight not return an exact conversion.

strncan be a character array, a cell array of character vectors, or a string column vector. Ifstrnis a character array, then each row represents a number in the base specified bybase. Ifstrnis 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.

Was this topic helpful?