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

    %% Compare Two Cell Arrays of Character Vectors
% Compare each element in two cell arrays of character vectors.
s1 = {'Time','flies','when';
      'you''re','having','fun.'};
s2 = {'Time','drags','when';
      'you''re','anxiously','waiting.'};
tf = strcmp(s1,s2) 

%%
% There are three instances of equal elements in |s1| and |s2|. These are
% |'Time'| at indices |(1,1)|, |'when'| at indices|(1,3)|, and |'you''re'|
% at indices |(2,1)|.