| MATLAB Function Reference | Search  Help Desk |
| bitset | Examples See Also |
C = bitset(A,bit) C = bitset(A,bit,v)
C = bitset(A,bit)
sets bit position bit in A to 1 (on). 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.
C = bitset(A,bit,v)
sets the bit at position bit to the value v, which must be either 0 or 1.
Setting the fifth bit in the five-bit binary representation of the integer 9 (01001) yields 11001, or 25.
C = bitset(9,5)
C =
25
bitand Bit-wise AND
bitcmp Complement bits
bitget Get bit
bitmax Maximum floating-point integer
bitor Bit-wise OR
bitshift Bit-wise shift
bitxor Bit-wise XOR