From: DD on
I have a N*2 array A. I want to calculate the min value in column 2 for each possible value in column 1, for example:

A=[1,2;1,3;2,3;2,4], I need a function which can give the the result like [1,2;2,3].

Using loop is unacceptable because the performance is too low when data amount is very large. Are there any fast ways to achieve that?

Thanks a lot.
From: DD on
Many thanks for your help, it is very good. I found there is no 'first' parameter for unique(), however, I can use IDX =[1;IDX(1:end-1)+1]; to get the IDX I want.