How is it for simplicity -
A(~any(tril(squeeze(all(bsxfun(@eq,A,permute(fliplr(A),[3 2 1])),2))),2),:)
Playing code-golf ? Well, here we go -
A(~any(tril(pdist2(A,fliplr(A))==0),2),:)
If we are talking about only two column matrices, here's a simpler version of bsxfun -
M = bsxfun(@eq,A(:,1).',A(:,2)); %//' out = A(~any(tril(M & M.'),2),:)
Run Example -
A = 1 2 3 6 7 1 6 5 6 3 2 1 3 4 >> A(~any(tril(squeeze(all(bsxfun(@eq,A,permute(fliplr(A),[3 2 1])),2))),2),:) ans = 1 2 3 6 7 1 6 5 3 4 >> A(~any(tril(pdist2(A,fliplr(A))==0),2),:) ans = 1 2 3 6 7 1 6 5 3 4
source share