Find a value in structure

10 views (last 30 days)
AI-CHI Chang
AI-CHI Chang on 22 Mar 2022
Commented: Arif Hoq on 22 Mar 2022
The answer below that question is.
valuetofind = 58;
find(arrayfun(@(s) ismember(valuetofind, s.cluster), clusters))
But if I want to find one value in different fields?
e.g. 18841 maybe in e1||e2||e3 ,and I want to return the index 4
  1 Comment
Arif Hoq
Arif Hoq on 22 Mar 2022
you can extract the field e1,e2 and e3, then you can use ismember function

Sign in to comment.

Answers (0)

Categories

Find more on Structures 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!