[TOC]
xor
Element-wise exclusive OR operation
Usage
xor(A, B)
A and B should be real numeric arrays with compatible sizes.
- It does not work if any one of the inputs is complex.
- If the inputs have different but compatible sizes, one of them will be expanded to match the size of the other one. In particular, if one of the inputs is scalar, it compares this scalar with each element of the other input.
- An element of the output is assigned logical
1 if exactly one of the corresponding elements of A or B is non-zero, and is assigned logical 0 if otherwise.
Examples
xor(1,1)
xor(1,0)
xor(-1,1)
xor(-1,0)
Output
ans =
0
ans =
1
ans =
0
ans =
1