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

    %% Difference of Two Vectors and Indices to Different Values  

%% 
% Define two vectors with values in common. 
A = [3 6 2 1 5 1 1]; 
B = [2 4 6];  

%% 
% Find the values in |A| that are not in |B| as well as the index vector
% |ia|, such that |C = A(ia)|. 
[C,ia] = setdiff(A,B)