bitand
Bitwise and.
z=bitand(x,y)
| Inputs |
x |
A one dimensional integer array or scalar. |
y |
A one dimensional integer array of the same size as x or a scalar.
|
| Outputs |
z |
An integer array. If x is an array, z is of the same size as x . Otherwise the size of z is same as the size of
y .
|
Description
Each element of the output is bit-wise and of the corresponding
elements of the input arrays. If one of the elements is scalar
the bit-wise and operator is applied to the scalar and each element of
the other array.
Example
>>bitand([1 2 4 5],[ 11 26 64 8])
1 2 0 0
>>a=round(randn(3,2,4));
>>a
[:,1:2, 1]
0 -1.0000
0 1.0000
1.0000 -1.0000
[:,1:2, 2]
-1.0000 2.0000
0 1.0000
2.0000 1.0000
[:,1:2, 3]
0 1.0000
0 0
1.0000 -1.0000
[:,1:2, 4]
0 1.0000
0 -1.0000
1.0000 2.0000
>>bitand(a,31)
[:, :, 1]
0 31
0 1
1 31
[:, :, 2]
31 2
0 1
2 1
[:, :, 3]
0 1
0 0
1 31
[:, :, 4]
0 1
0 31
1 2