Thats the reason why the elements of your vector IndMax are nested vectors. Think you better search only in the appropriare column of O and use the index obtained to lookup the x-value in the first column.
The thing is that I need maximum values of each i.e. 192 columns.
- What kind of data structure do you have on mind for your x,y pairs? With the data you provide you will get at least 192 pairs. Should it be a 192x2 matrix or do you need a 192 element vector consisting of 1x2 or 2x1 vectors, or something else?
The most approptiate presentation would be 192x2 matrix i.e. 192 rows and 2 columns. The values should be the same as the one obtained in nested arrays.
- What should happen if a y-column contains the maximum value more than once? Should only the first occurence be taken or do you need all in your result.
I dont expect that there are two or more same y values within one column. However, if that is the case I would need all in my result.
P.S.
Maybe the approach with range variable I used is not the best. I have nothing against if there is another approach which can analyze matrix columns, search for maximum and give row index where the max value is.
Thanks