Find a word in structure

2 次查看(过去 30 天)
Erik Verdijk
Erik Verdijk 2018-3-30
Ik like to find a word (example:cat)in a structure field (by example: structureA.field1). How can you do that?

回答(1 个)

Birdman
Birdman 2018-3-30
编辑:Birdman 2018-3-30
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 个评论
Stephen23
Stephen23 2018-3-30
@Erik Verdijk: What version of MATLAB are you using?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by