Convert text representation of binary number to decimal number
bin2dec(
binarystr
)
bin2dec(
interprets binarystr
)binarystr
,
text that represents a binary number, and returns the equivalent decimal
number. binarystr
must represent a nonnegative
integer value smaller than or equal to the value returned by flintmax
.
binarystr
can be a character array
or a cell array of character vectors. bin2dec
ignores
any space (' '
) characters in the input text.
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