| MATLAB Function Reference | ![]() |
C = xor(A, B)
C = xor(A, B) performs an exclusive OR operation on the corresponding elements of arrays A and B. The resulting element C(i,j,...) is logical true (1) if A(i,j,...) or B(i,j,...), but not both, is nonzero.
A | B | C |
|---|---|---|
Zero | Zero | 0 |
Zero | Nonzero | 1 |
Nonzero | Zero | 1 |
Nonzero | Nonzero | 0 |
Given A = [0 0 pi eps] and B = [0 -2.4 0 1], then
C = xor(A,B) C = 0 1 1 0
To see where either A or B has a nonzero element and the other matrix does not,
spy(xor(A,B))
all, any, find, Elementwise Logical Operators, Short-Circuit Logical Operators
![]() | xmlwrite | xslt | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |