Find a word in structure

3 views (last 30 days)
Erik Verdijk
Erik Verdijk on 30 Mar 2018
Commented: Erik Verdijk on 30 Mar 2018
Ik like to find a word (example:cat)in a structure field (by example: structureA.field1). How can you do that?

Answers (1)

Birdman
Birdman on 30 Mar 2018
Edited: Birdman on 30 Mar 2018
One approach:
structureA=struct;
structureA.field1="cat";
strfind(structureA.field1,"cat")
It will return 1 since the number of cat word in second argument of strfind function is 1.
  5 Comments

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!