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 decimal number to character vector representing base N number


str = dec2base(d, base)
str = dec2base(d, base, n)


str = dec2base(d, base) converts the nonnegative integer d to the specified base. d must be a nonnegative integer smaller than the value returned by flintmax, and base must be an integer between 2 and 36. The returned argument str is a character vector.

str = dec2base(d, base, n) produces a representation with at least n digits.


The expression dec2base(23, 2) converts 2310 to base 2, returning the character vector '10111'.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a