www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SymmetricDifferenceofRowsinTwoMatricesExample.m
%% Symmetric Difference of Rows in Two Matrices %% % Define two matrices with rows in common. A = [7 8 9; 7 7 1; 7 7 1; 1 2 3; 4 5 6]; B = [1 2 3; 4 5 6; 7 7 2]; %% % Find the rows of |A| and |B| that are not in their intersection as well % as the index vectors |ia| and |ib|. [C,ia,ib] = setxor(A,B,'rows') %% % |C| is a sorted combination of the rows of |A(ia,:)| and |B(ib,:)|.