MATLAB Function Reference | ![]() ![]() |
Find possible matches for a string
Syntax
i = strmatch('str
',STRS) i = strmatch('str
',STRS,'exact')
Description
i = strmatch('
looks through the rows of the character array or cell array of strings str
',STRS)
STRS
to find strings that begin with string str
, returning the matching row indices. strmatch
is fastest when STRS
is a character array.
i = strmatch('
returns only the indices of the strings in str
',STRS,'exact')
STRS
matching str
exactly.
Examples
i = strmatch('max',strvcat('max','minimax','maximum'))
returns i = [1; 3]
since rows 1 and 3 begin with 'max'
. The statement
i = strmatch('max',strvcat('max','minimax','maximum'),'exact')
returns i = 1
, since only row 1 matches 'max'
exactly.
See Also
strcmp
, strcmpi
, strncmp
, strncmpi
, findstr
, strvcat
![]() | strjust | strncmp | ![]() |