findstr
Find one string within another (returns positions of all occurrences).
Syntax
Section titled “Syntax”k = findstr(str1, str2)Description
Section titled “Description”Searches for the shorter of str1 and str2 within the longer, returning a vector of starting indices for each occurrence. Returns an empty array if no match is found.
Note: MATLAB has deprecated findstr in favor of strfind, which has clearer asymmetric semantics. Prefer strfind for new code.
Example
Section titled “Example”findstr('the cat', 't') % [1 5]