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

    %% Cell Array of Character Vectors with Trailing White Space  

%% 
% Create a cell array of character vectors, |A|, where some of the vectors
% have trailing white space.
A = {'dog','cat','fish','horse','dog ','fish '};  

%% 
% Find the unique character vectors contained in |A|. 
C = unique(A) 

%%
% |unique| treats trailing white space in cell arrays of character vectors
% as distinct characters.