Main Content


Least significant bit



c = getlsb(a) returns the value of the least significant bit in a.


collapse all

Use getlsb to find the least-significnat bit in the fi object a.

a = fi(-26, 1, 6, 0);
c = getlsb(a)
c = 

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Unsigned
            WordLength: 1
        FractionLength: 0

You can verify that the least sigificant bit in the fi object a is 0 by looking at the binary representation of a.


Input Arguments

collapse all

Input fi object, specified as a scalar, vector, matrix, or multidimensional array. getlsb only supports fi object with fixed-point data types.

Data Types: fi

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Version History

Introduced in R2007b