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.

bin2dec

Convert binary number string to decimal number

Syntax

bin2dec(binarystr)

Description

bin2dec(binarystr) interprets the binary string binarystr and returns the equivalent decimal number. binarystr must represent a nonnegative integer value smaller than or equal to 2^52.

bin2dec ignores any space (' ') characters in the input string.

Examples

Binary 010111 converts to decimal 23:

bin2dec('010111')
ans =
    23

Because space characters are ignored, this string yields the same result:

bin2dec(' 010   111 ')
ans =
    23

See Also

Was this topic helpful?