Let, say, two matrices
A = [1,2,3;
2,4,5;
8,3,5]
B= [2,3;
4,5;
8,5]
How to execute sedifffor each row in A and B, respectively, without using loops or cellfun, in other words, execution setdiff(A(i,:),B(i,:))for everyone i. In this example, I want to get
[1;
2;
3]
I am trying to do this for two very large matrices for my fluid simulator, so I cannot compromise on performance.
UPDATE:
you can assume that the second dimension (the number of columns) of the response will be fixed, for example. the answer will always be some matrix n by m, and not some dangling array of different column sizes.
Another example:
A B m 3 m 2 , m 1. , m n1, m n2 m n3 . -
A = [1,2,3,4,5;
8,4,7,9,6]
B = [2,3;
4,9]
C = [1,4,5;
8,7,6]