[b,idx]=min(a,,2) — gives the value as well as the index of the min value of each row of matrix a.
Now the ques is – how to get b if i've 'a' & 'idx'.
For 2D,i can use a for loop to do it.
But how to do it for ND scenarios?
a=[0.8147 0.9134 0.27850.9058 0.6324 0.54690.1270 0.0975 0.9575]b=[0.27850.54690.0975]idx=for i=1:length(idx)b(i)=a(i,idx(i));end
— it'll do for 2D.