matlab - Bitxor and Count the different rows values between two matrixes -



matlab - Bitxor and Count the different rows values between two matrixes -

i have 2 matrixes such as

a = 0 1 1 0 0 0 1 1 1 1 1 1 1 0 1 0 0 0 0 0

and b b =

0 1 1 0 1 1 1 1 -1 -1 -1 -1 1 0 1 0 0 0 0 0

my task how count number of different row row between , b. example, values of sec row , sec row b different, count increment 1. values in 3rd row , 3rd row b different, count values 2 now. hence, total different values row row between , b 2. how implement matlab?

update: give thanks nemesis first question. have other question matrix a. want implement bitxor between rows of matrix a. simplicity, utilize rem function 2. index of rows xor store in index array. code

index=[1 2 4] % row 1,2,4 xor output=rem(sum(a(index,:)),2);

the above code works index size >1. when index size equals 1 mean output values copied row of a. example, index=[1] ouput=a(1)=0 1 1 0. problem cannot apply above code when index size equals 1. happen? edit me?

this same question here, little extension. summarized, can utilize reply @andrey

ix = sum(sum(abs(a-b),2)~=0) ix = 2

regarding update of question. issue is, sum single row utilize 2 direction (instead of default 1 want), since size(...,1)==1. can forcefulness direction in next way:

output=rem(sum(a(index,:),1),2)

matlab

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -