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.
答案 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)