Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

binvec2dec

Convert digital input and output binary vector to decimal value

Syntax

out = binvec2dec(bin)

Arguments

bin

A binary vector.

out

A double array.

Description

out = binvec2dec(bin) converts the binary vector bin to the equivalent decimal number and assigns the result to out. All nonzero binary vector elements are interpreted as a 1.

Examples

To convert the binvec value [1 1 1 0 1] to a decimal value:

binvec2dec([1 1 1 0 1])
ans =
    23

More About

collapse all

Tips

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].

    Note   The binary vector cannot exceed 52 values.

See Also

Was this topic helpful?