I have an array comprising n rows and 4 colums. Each of the four entries on the row is an integer, i.e.,
X = [
111 112 432 2
6 9 115 111
First, sort the rows of your matrix to arrive at a "canonical" representation for the tetrahedra:
X = sort(X, 2);
Then, use unique
with the optional 'rows'
argument to find unique rows:
Y = unique(X, 'rows');
you should sort the rows first, then use unique(A,'rows') as HPM suggests
unique() will work on rows, but rows 1 and 3 are a different order. So we could sort them prior to using unique.
Y=unique(sort(X,2),'rows')
Y =
2 111 112 432
6 9 111 115
If you want to retain the original ordering then unique will return the indices
[Y,yi]=unique(sort(X,2),'rows');
>> X(yi,:)
ans =
112 432 111 2
6 9 115 111
To quote from the documentation:
b = unique(A, 'rows') returns the unique rows of A.
Is that what you want ?