replacement for findstr

7 views (last 30 days)
G
G on 25 Aug 2011
findstr('text', guidata.dataFile{1,1}.header{i})
header{i} is a 1x4 char (in this example named text)
I have a loop that dynamically generates radio button position and color based on a header row. What I have now works fine but because findstr seems to be on the chopping block I am trying to update the code. I have tried strncmp and regexp but can't seem to figure it out.
Any help is appreciated.

Answers (1)

Jan
Jan on 25 Aug 2011
Do your mean STRFIND?
  9 Comments
Jan
Jan on 25 Aug 2011
FINDSTR had the risky feature that the shorter string is searched in the longer one. If you want to look for the position of 'one' inside 'stone', the reply of FINDSTR will be surprising, if the 2nd string is 'e'.
MATLAB 2009a still ontained several dangerous FINDSTR calls. Perhaps they are replaced by STRFIND now, which searches the 2nd string inside the first one.
Jan
Jan on 25 Aug 2011
FINDSTR had the risky feature that the shorter string is searched in the longer one. If you want to look for the position of 'one' inside 'stone', the reply of FINDSTR will be surprising, if the 2nd string is 'e'.
MATLAB 2009a still ontained several dangerous FINDSTR calls. Perhaps they are replaced by STRFIND now, which searches the 2nd string inside the first one.

Sign in to comment.

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!