MATLAB: Min of each row of a matrix and their indexes

indexesmatrixmin

I have the topography data in which I introduced X, Y, Z as follows. How can I find min for each row of Z data and find their X and Y value?

Best Answer

X=[11 13 15]
Y=[43 45 47]
Z = [27 25 21;35 38 37 ;42 47 49]
[~,ii] = min(Z,[],2)
out = [X(ii)',Y(:)]