Accelerating the pace of engineering and science
Convert digital input and output binary vector to decimal
out = binvec2dec(bin)
You cannot use the legacy interface on 64-bit MATLAB®. See Working with the Session-Based Interface to acquire
and generate data on a 64-bit MATLAB.
A binary vector.
A double array.
out = binvec2dec(bin) converts
the binary vector bin to the equivalent decimal
number and stores the result in out. All nonzero
binary vector elements are interpreted as a 1.
To convert the binvec value [1 1 1 0 1] to a decimal value:
binvec2dec([1 1 1 0 1])
A binary vector (binvec) is constructed with the least significant
bit (LSB) in the first column and the most significant bit (MSB) in
the last column. For example, the decimal number 23 is written as
the binvec value [1 1 1 0 1].
The binary vector cannot exceed 52 values.
Join the conversation