www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/RowsThatBelongToASetExample.m

    %% Rows That Belong to a Set
% Create two matrices with a row in common.

% Copyright 2015 The MathWorks, Inc.

A = [1 3 5 6; 2 4 6 8];
B = [2 4 6 8; 1 3 5 7; 2 4 6 8];

%%
% Determine which rows of |A| are also in |B| as well as their
% corresponding locations in |B|.
[Lia, Locb] = ismember(A,B, 'rows')

%%
% The lowest index to |A(2,:)| is |B(1,:)|.