MATLAB: Keep only certain rows (with minimum values) from a matrix

matrix matrices matrixes min minima minimum row

I have the following matrix:
A = [1 2; 1 3; 1 1; 2 1; 2 2; 2 0]
which has an index (1, 2, etc…) in the first column, and the relevant information in the 2nd column.
I would like to reduce this matrix so that only 1 row stays with the same index: the row with the minimum relevant value (2nd column).
It should look like this:
B = [1 1; 2 0]
the rest of the rows should not appear.
Is there an easy way I could do that?
Thank you very, very much in advance. I've been trying this for hours now and can't find an easy way to obtain B.

Best Answer

col2=accumarray(A(:,1),A(:,2),[],@min).';
B=[1:length(col2);col2].'