Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

simple structure problem (return field name)

1 vue (au cours des 30 derniers jours)
JAE YEOL PARK
JAE YEOL PARK le 23 Mai 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
I'm a student who just started studying matlab.
I have a question on the structure, What should I do to return the 'name' of the person with the best eyesight, in this structure?
I'd really like to ask you for an answer.
man(1).name = 'lim jong su';
man(1).Height = 183;
man(1).Sight = [0.5 , 0.7];
man(2).name = 'lee do hyun';
man(2).Height = 180;
man(2).Sight = [1.5 , 1.2];
man(3).name = 'lee gi jung';
man(3).Height = 176;
man(3).Sight = [1.0 , 1.2];
  1 commentaire
Image Analyst
Image Analyst le 23 Mai 2019
Which one of those fields describes "Eyesight"? "Sight"? If so, which number? The min, max, mean???
Is this an assignment?

Réponses (1)

madhan ravi
madhan ravi le 23 Mai 2019
Since it's your assignment:
1) Use arrayfun() for Sight using sum() assuming the max sum is the best Sight.
2) max() the result of arrayfun() by taking the second input of max.
3) Index the second output of max() to man(index).name to get the name.

Community Treasure Hunt

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

Start Hunting!

Translated by