Section: String Functions
strfind
function. The first is for single strings
ndx = strfind(string, pattern)
the resulting array ndx
contains the starting indices in string
for the pattern pattern
. The second form takes a cell array of
strings
ndx = strfind(cells, pattern)
and applies the search operation to each string in the cell array.
strfind
to a simple string
--> a = 'how now brown cow?' a = how now brown cow? --> b = strfind(a,'ow') b = 2 6 11 16 --> quit
Here we search over multiple strings contained in a cell array.
--> a = {'how now brown cow','quick brown fox','coffee anyone?'} a = ['how now brown cow'] ['quick brown fox'] ['coffee anyone?'] --> b = strfind(a,'ow') b = [[1 4] int32] [9] [] --> quit