Hey again I want function that gives matrix C from A and B thanks
in fact if we have the same raw in A and B , we delete it and the result will be the matrix C
Best Answer
If your algorithm is to remove all rows that are common toA andB, and we are assuming that these two matrices have the same number of columns, then try the following:
A = [1 2 3; 4 5 6; 7 8 9; 10 20 30];
B = [11 12 13; 4 5 6; 14 15 16; 7 8 9; 17 18 19];
if size(A,2)==size(B,2)
% get the intersection of A and B, i.e. all those rows that are common
[Rows,IA,IB] = intersect(A,B,'rows');
% Rows is a matrix of the rows common to A and B
% IA is all the row numbers in A of those common rows
% IB is all the row numbers in B of those common rows
Best Answer