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

    %% Difference of Char and Cell Array of Character Vectors  
% Create a character vector, |A|. 
A = ['cat';'dog';'fox';'pig'];
class(A)  

%% 
% Create a cell array of character vectors, |B|. 
B={'dog','cat','fish','horse'};
class(B)  

%% 
% Find the character vectors in |A| that are not in |B|. 
C = setdiff(A,B)  

%% 
% The result, |C|, is a cell array of character vectors. 
class(C)