MATLAB Function Reference
  Go to function:
    Search    Help Desk 
bitget    Examples   See Also

Get bit

Syntax

Description

C = bitget(A,bit) returns the value of the bit at position bit in A. Operand A must be a nonnegative integer, and bit must be a number between 1 and the number of bits in the floating-point integer (flint) representation of A (52 for IEEE flints). To ensure the operand is an integer, use the ceil, fix, floor, and round functions.

Example

The dec2bin function converts decimal numbers to binary. However, you can also use the bitget function to show the binary representation of a decimal number. Just test successive bits from most to least significant:

See Also

bitand      Bit-wise AND

bitcmp      Complement bits

bitmax      Maximum floating-point integer

bitor       Bit-wise OR

bitset      Set bit

bitshift    Bit-wise shift

bitxor      Bit-wise XOR



[ Previous | Help Desk | Next ]