Find a word in structure

1 vue (au cours des 30 derniers jours)
Erik Verdijk
Erik Verdijk le 30 Mar 2018
Commenté : Erik Verdijk le 30 Mar 2018
Ik like to find a word (example:cat)in a structure field (by example: structureA.field1). How can you do that?

Réponses (1)

Birdman
Birdman le 30 Mar 2018
Modifié(e) : Birdman le 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 commentaires
Stephen23
Stephen23 le 30 Mar 2018
@Erik Verdijk: What version of MATLAB are you using?
Erik Verdijk
Erik Verdijk le 30 Mar 2018
R2016a

Connectez-vous pour commenter.

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by