MATLAB: Eliminate a row where a column has repeated values

matrixmatrix manipulation

Hi I have the following matrix
eliti =
Columns 1 through 8
0 0 1.0000 0 0 0 0 0
0 0 1.0000 0 0 0 0 0
0 1.0000 0 1.0000 1.0000 0 0 0
Columns 9 through 16
0 0 0 0 0 1.0000 1.0000 0
1.0000 1.0000 0 0 0 0 1.0000 0
0 0 0 0 0 0 1.0000 0
Columns 17 through 21
-24.0000 38.0000 10.0751 0.0413 0.2388
-52.0000 26.0000 11.1629 0.0458 0.6012
-24.0000 38.0000 10.0751 0.0413 0.3106
And I need to eliminate where there a repeated values in the 18th column so it will be like this eliti =
Columns 1 through 8
0 0 1.0000 0 0 0 0 0
0 1.0000 0 1.0000 1.0000 0 0 0
Columns 9 through 16
1.0000 1.0000 0 0 0 0 1.0000 0
0 0 0 0 0 0 1.0000 0
Columns 17 through 21
-24.0000 38.0000 10.0751 0.0413 0.2388
-52.0000 26.0000 11.1629 0.0458 0.6012

Best Answer

[~,b] = unique(eliti(:,18),'stable');
eliti_new = eliti(b,:);