FUNCTION REFERENCE

bitset

Set or clear a bit in each integer value.

Set or clear a bit in each integer value.

Syntax

bitset(A, BIT); bitset(A, BIT, V); bitset(A, BIT, V, ASSUMEDTYPE)

V defaults to 1; zero clears a bit and a nonzero value sets it. Equal-size arrays or scalar inputs are accepted. Integer output keeps the input class, including the sign bit of signed integers. Double inputs default to an assumed uint64 type.

Example

bitset([1 2 4], 1)   % [1 3 5]

Differences from MATLAB: none known.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.