Section: Bitwise Operations
y = bitand(a,b)
where a
and b
are unsigned integer arrays. The and
operation
is performed using 32 bit unsigned intermediates. Note that if a
or b
is a scalar, then each element of the other array is anded with
that scalar. Otherwise the two arrays must match in size.
--> bitand([3 4 2 3 10 12],5) ans = 1 4 0 1 0 4
This is a nice trick to look for odd numbers
--> bitand([3 4 2 3 10 12],1) ans = 1 0 0 1 0 0