Fixed-Point Blockset | ![]() ![]() |
Set the specified bit of the stored integer to one
Library
Description
The Bit Set block is a masked block that sets the specified bit of the stored integer to one. Scaling is ignored.
You can specify the bit to be set to one with the Index of bit parameter, where bit zero is the least significant bit.
True floating-point data types are not supported.
Parameters and Dialog Box
Examples
If the Bit Set block is turned on for bit 2
, bit 2
is set to 1
. A vector of constants
2.^[0 1 2 3 4]
is represented in binary as [00001 00010 00100 01000 10000]. With bit 2 set to 1, the result is [00101 00110 00100 01100 10100], which is represented in decimal as [5 6 4 12 20]
.
Characteristics
Input Port |
Any data type supported by the blockset, except a true floating-point data type |
Output Port |
Same as the input |
Direct Feedthrough |
Yes |
Scalar Expansion |
Yes |
See Also
![]() | Bit Clear | Bitwise Operator | ![]() |