MATLAB: How to check if two elements are in a row of a matrix

matrix manipulationrows and columns

suppose
A=[1 2;
4 5;
6 9]
B=[1 3 5 6;
1 2 4 7;
5 6 4 8;
1 2 3 4].
In this case 1,2 of 1st row of A are present in 2nd row B, similarly all rows of A have to check with rows of B, and create a matrix &nbsp C=[6 9] &nbsp which are not present in any row of B.

Best Answer

Here is one clumsy way:
A=[1 2;
4 5;
6 9];
B=[1 3 5 6;
1 2 4 7;
5 6 4 8;
1 2 3 4];
rowCountA = size(A,1);
rowCountB = size(B,1);
this_row_of_A_is_in_B = false(rowCountA,1);
for nb = 1:rowCountB
this_row_of_A_is_in_B = this_row_of_A_is_in_B | all(ismember(A,B(nb,:)),2);
end
rows_of_A_that_are_not_in_B = A(not(this_row_of_A_is_in_B),:)