%% Compare First N Characters of Character Vectors
% Create two different character vectors. Compare the first 11 characters of them.

s1 = 'Kansas City, KS';
s2 = 'Kansas City, MO';
tf = strncmp(s1,s2,11)

%
% tf is 1 because both character vectors start with 'Kansas City'.
% Compare the two character vectors using strcmp.

tf = strcmp(s1,s2)

% tf is 0 because s1 and s2 end with different characters.
% Copyright 2012 The MathWorks, Inc.