FUNCTION REFERENCE

dec2bin

Decimal to binary text.

Decimal to binary text.

Syntax

s = dec2bin(d)

Syntax

s = dec2bin(d, len)

Character matrix with one row per element of d (taken column by column),

padded with leading zeros to a common width of at least len digits.

Fractional nonnegative inputs are truncated, as in MATLAB.

Example

dec2bin(5)   % '101'

Inputs range from 0 through 2^53, inclusive.

Differences from MATLAB: Output is limited to 65536 UTF-16 units.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.