bi2de

Converts numbers from binary or a specified base to their decimal equivalents.

Syntax

R = bi2de(m)

R = bi2de(m, base)

R = bi2de(m, base, fmt)

Inputs

m
Finite, non-negative matrix of integers.
Type: matrix
base (optional)
Integer greater than or equal to 2 (default), used as the base for the output, R.
Type: integer
fmt (optional)
Contains values 'right-msb' or 'left-msb', which specify whether the first or last element of m is most-significant. The default value is 'right-msb'.
Type: string

Outputs

R
Decimal representation of m.
Type: matrix

Examples

Binary to decimal with default values:
R = bi2de([0,0,0,1,1,1])
R = 56
Binary to decimal in base 5:
R = bi2de([0,0,0,1,1], 5)
R = 750
Binary to decimal in base 3, specifying left-msb:
r = de2bi([12, 23456, 45, 6777], [], 3, 'left-msb');
R = bi2de(r, 3, 'left-msb')
R = [Matrix] 4 x 1
   12
23456
   45
 6777