TF = strcmp(string,string)
TF = strcmp(string,cellstr)
TF = strcmp(cellstr,cellstr)
注:string: A single character string or n-by-1 array of strings;
cellstr: A cell array of strings.
Example:
1、strcmp('Yes', 'No')
ans =
0
strcmp('Yes', 'Yes')
ans =
1
2、Create two cell arrays of strings and call strcmp to compare them:
A = {'Handle Graphics', 'Statistics'; ... ' Toolboxes', 'MathWorks'}; B = {'Handle Graphics', 'Signal Processing'; ... 'Toolboxes', 'MATHWORKS'};
match = strcmp(A, B) match = 1 0 0 0
3、
A = {'Handle Graphics', 'Statistics'; ... ' Toolboxes', 'MathWorks'}; B = {'Handle Graphics'};
match = strcmp(A, B) match = 1 0 0 0