strmatch
- :
idx =strmatch(s, A)¶ - :
idx =strmatch(s, A, "exact")¶ -
Find the entries of A that start with s. This function is kept for old code only; new code should use
strncmporstrcmp. The first call issueswarning ("nexus:deprecated:strmatch", …).A may be a string, a character matrix (one entry per row) or a cell array of strings. The result is a column of the indices of the matching entries. Trailing blanks and null characters are ignored on both sides. With the option
"exact"an entry must equal s, not merely begin with it.strmatch ("pine", "pineapple") ⇒ 1 strmatch ("pine", ["pine "; "pineapple"; "a pine "]) ⇒ [1; 2] strmatch ("pine", ["pine "; "pineapple"; "a pine "], "exact") ⇒ 1Depending on the task,
strncmp,strcmp,regexporvalidatestringwill usually be a clearer replacement.