Reza Sh
Reza Sh

Reputation: 77

How to Xor on integer arrays in matlab

i need a efficient way to XOR two array of integer numbers in matlab. For example:

A=[3,4,5,1,6,7,3];

B=[3,5,5,2,6,2,3];

the result for C=Xor(A,B) must be:

C=[0,1,0,1,0,1,0]

i need to run this many times on large arrays, so efficiency is very important. thank you in advance

Upvotes: 0

Views: 318

Answers (1)

OmG
OmG

Reputation: 18838

You can do it likes the following:

C = (A ~= B);

Upvotes: 3

Related Questions