dec2base

Convert decimal number to another base.

Syntax

  • R = dec2base(D, B)

  • R = dec2base(D, B, N)

Input argument

  • D - a nonnegative integer smaller than the value returned by flintmax.

  • B - an integer value [2, 36].

  • N - an integer value. number of digits.

Output argument

  • R - result of dec2base: char array.

Description

dec2base converts decimal number to another base.

values are cached to speed up next computation dec2base([], 2) to clear cache.

Example

X = [65535 128; 1 0]
Y = dec2base(X, 2)
Y = dec2base(X, 2, 26)

See also

base2dec.

History

Author

Allan CORNET

Last updated