www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SymmetricDifferenceofTwoTablesandIndicestoDifferentRowsExample.m
%% Symmetric Difference of Two Tables and Indices to Different Rows %% % Define a table, |A|, of gender, age, and height for five people. A = table(['M';'M';'F'],[27;52;31],[74;68;64],... 'VariableNames',{'Gender' 'Age' 'Height'},... 'RowNames',{'Ted' 'Fred' 'Betty'}) %% % Define a table, |B|, with the same variables as |A|. B = table(['F';'M'],[64;68],[31;47],... 'VariableNames',{'Gender' 'Height' 'Age'},... 'RowNames',{'Meg' 'Joe'}) %% % 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) %% % |C| is a sorted combination of the elements |A(ia,:)| and |B(ib,:)|.