I have a matrix A
in Matlab
A= [1 2 3 |1;
2 3 4 |2;
5 6 7 |2;
3 4 5 |1;
6 7 0 |3;
6 3 7 |3;
4 5 3 |1;
6 5 4 |4]
where the last column contains natural indices possibly repeated. For each index in the last column, I want to select the first row of A
associated with that index and create the matrix
B=[1 2 3 |1;
2 3 4 |2;
6 7 0 |3;
6 5 4 |4]