In Matlab...
Here is a sample from a larger matrix:
5 11 9 12
5 11 12 9
5 9 11 12
5 9 12 11
5 12 9 11
5 12 11 9
12 11 9 7
12 11 7 9
12 9 11 7
12 9 7 11
12 7 9 11
12 7 11 9
11 12 9 7
11 12 7 9
11 9 12 7
11 9 7 12
11 7 9 12
11 7 12 9
9 11 12 7
9 11 7 12
9 12 11 7
9 12 7 11
9 7 12 11
9 7 11 12
7 11 9 12
7 11 12 9
7 9 11 12
7 9 12 11
7 12 9 11
7 12 11 9
I'd like some code that will look through this matrix and find all of the vectors that transpose to each other, e.g.
7 12 9 11
and
6 11 8 10
and create a new matrix that contains only one version for each of the transposing vectors, in its lowest transposition available on the original matrix (i.e. if the original matrix contained:
7 12 9 11
and
6 11 8 10
Then I would only want to keep
6 11 8 10
(Similarly I'd like the list to keep any vectors for which there are no transpositions)
vectors that transpose to each other? - DivakarN=bsxfun(@minus,M(:,1),M)to get a matrix where the rows which you call transposed are equal, then useuniqueto identify the rows which are transposed to each other[~,~,index]=unique(N,'rows')- Daniel