MATLAB: Minimum y-value in each column

2-dMATLABplot

How to find the first y value (in red) efficiently in each column of the image below?

Best Answer

[~,idx] = max(X);
Note that this returns 1 for columns that are all zero.