MATLAB: I am trying to find the index for the maximum y. someone help?

find the index for the maximum y in an array

I have the following
y =
Columns 1 through 9
0.0101 0.0105 0.0101 0.0096 0.0257 0.0105 0.0103 0.0097 0.0097
Column 10
0.0103
and
index =
Columns 1 through 7
14148 14369 14580 14772 6257 14970 15281
Columns 8 through 10
15414 15058 15806
I know is 6257 but whats the code. I tried but keep getting 166252??I don't know why?

Best Answer

[max_y,idx_to_max_y] = max(y);
indexAtMax = index(idx_to_max_y);