title: Eliminate repeated vectors but with elements on different order
body: <p>I have a matrix <code>A</code> which is (243 x 5). I want to pick the unique row vectors of that matrix but taking into account that row vectors with the same elements but in different order shall be considered as being the same. </p>
  
  <p>E.g., suppose for simplicity that the <code>A</code> matrix is (10 x 5) and equal to:</p>
  
  <pre><code> A=[1   2   1   2   3
      1   3   1   1   1
      1   3   1   1   2
      1   2   1   1   3
      2   3   1   2   1
      1   3   1   2   2
      1   3   1   2   3
      1   3   1   3   2
      1   3   1   3   1
      1   3   2   3   1]
  </code></pre>
  
  <p>On the example above, rows (1, 5, 6) are to be considered equivalent they have the same elements but in different order. Also, rows (3 and 4) are equivalent, and rows (7, 8, 10) are also equivalent.</p>
  
  <p>Is there any way to write a code that removes all "repeated rows", i.e. a code that delivers only the rows (1, 2, 3, 7 and 9) from A?</p>
  
  <p>So far I came across with this solution:</p>
  
  <pre><code>B(:,1) = sum(A == 1,2);
  B(:,2) = sum(A == 2,2);
  B(:,3) = sum(A == 3,2);
  [C, ia, ic] = unique(B,'rows');
  Result = A(ia,:);
  </code></pre>
  
  <p>This delivers what I am looking for with one caveat - it is delivering the unique rows of A according to the criteria defined above, but it is not delivering the first row it finds. I.e. instead of delivering rows (1,2,3,7,9) it is delivering rows(7, 1, 9, 3, 2). </p>
  
  <p>Anyway I can force him to deliver the rows in correct order? Also any better way of doing this?</p>