Data Acquisition Toolbox | ![]() ![]() |
Convert binary vector to decimal value
Syntax
Arguments
bin |
A binary vector. |
out |
A double array. |
Description
converts the binary vector out = binvec2dec(bin)
bin
to the equivalent decimal number and stores the result in out
. All nonzero binary vector elements are interpreted as a 1.
Remarks
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].
Example
To convert the binvec value [1 1 1 0 1] to a decimal value:
Functions
![]() | analogoutput | clear | ![]() |