%% Find Pattern in Cell Array
% Find the starting indices for occurrences of a pattern in a cell array of character vectors.
% Create a cell array of character vectors.

str = {'How much wood would a woodchuck chuck';
       'if a woodchuck could chuck wood?'};

%
% Find the pattern wood in str.

idx = strfind(str,'wood')

%
% Examine the output cell array to find the instances of the pattern.

idx{:,:}

% The pattern wood occurs at indices 10 and 23 in the first character vector and at indices 6 and 28 in the second character vector.
% Copyright 2012 The MathWorks, Inc.