How can I find a cell's location using the max function on a struct?

时间:2015-07-31 20:51:07

标签: matlab

I have a struct with one field. I want to find the max value in the struct, but also know which row it is located in. How do I do this?

Currently I have:

max(getfield(red2_mean, 'MeanIntensity'))

With red2_mean as the struct name, and MeanIntensity as the field.

This returns the correct maximum value, but I don't know which row (cell number?) it's in.

1 个答案:

答案 0 :(得分:1)

Not sure I understand you fully, but if you have only a single fields why wont you try:

[val id]=max(red2_mean.MeanIntensity)
相关问题