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

    %% Table Rows Found in Another Table
% Create two tables with rows in common.

% Copyright 2015 The MathWorks, Inc.

A = table([1:5]',['A';'B';'C';'D';'E'],logical([0;1;0;1;0]))
B = table([1:2:10]',['A';'C';'E';'G';'I'],logical(zeros(5,1)))

%%
% Determine which rows of |A| are also in |B|.
Lia = ismember(A,B)

%%
% |A(1,:)|, |A(3,:)|, and |A(5,:)| are found in |B|.