Using this method on a 8x8 matrix:
>> [junk,index] = unique(data,\'first\'); %# Capture the index, ignore junk >> data(sort(index))
If you want unique rows, while keeping original order, try this:
[M,ind] = unique(data, 'rows', 'first'); [~,ind] = sort(ind); M = M(ind,:);
Example:
>> data = randi(2,[8 3]); data = 1 2 1 1 2 1 1 1 2 2 2 2 1 1 1 2 2 2 2 2 2 2 1 1 >> M M = 1 2 1 1 1 2 2 2 2 1 1 1 2 1 1