Loading [Contrib]/a11y/accessibility-menu.js

bin2dec

Converts binary numbers to their decimal equivalents.

Syntax

R = bin2dec(s)

Inputs

s
String, matrix or cell array representing binary number(s). Spaces are ignored.
Type: string | mat | cell

Outputs

R
If s is a matrix or cell array, R is a column matrix with one row for each element. Any conversions which are invalid will result in 'Nan'
Type: integer | mat

Examples

String to integer:
R = bin2dec('1100001')
R = 97
Matrix of strings with spaces:
R = bin2dec(['0110 0001'; '0100 0001'; '0000 0001'])
R =
97
65
 1