%% Unique Rows in Matrix
% Create a 10-by-3 matrix with some repeated rows.

A = randi(3,10,3)

%
% Find the unique rows of A based on the data in the first two columns. Specify three outputs to return the index vectors ia and ic.

[C,ia,ic] = unique(A(:,1:2),'rows')

%
% Use ia to index into A and retrieve the rows that have unique combinations of elements in the first two columns.

uA = A(ia,:)

% Copyright 2012 The MathWorks, Inc.