%% Compare First N Characters While Ignoring Case
% Create two character vectors. Compare the first four characters of each, ignoring case.

s1 = 'DATA.TAR.GZ';
s2 = 'data-samples.xls';

tf = strncmpi(s1,s2,4)

% tf is 1 because s1 starts with 'DATA', and s2 starts with 'data'.
% Copyright 2012 The MathWorks, Inc.