Reputation: 17040
Try this
>> A = [1 2];
>> B = [1 4];
>> xor(A, B)
ans =
0 0
How? Where's the mistake?
Upvotes: 2
Views: 1278
Reputation: 7650
I think the mistake is, that matlab treats everything != 0 as true. And as we know
true xor true -> false.
Perhaps Fast xor array in matlab can help you.
Upvotes: 1
Reputation: 5276
You should use the bitwise XOR:
>> A = [1 2]
>> B = [1 4]
>> C = bitxor(A, B)
>> C
C =
0 6
Upvotes: 5