I have a n-by-3 matrix. Like so:
mtx = [3 1 3;
2 2 3;
2 3 2;
5 4 1]
I want the end result to be:
mtx2 = [0 0 0;
2 2 3;
2 3 2;
0 0 0]
So I want to put zeros on the rows that don't have the first number as another, and that their 2nd number doesn't equal the 3rd of another.
Imagine that the first number of any row is 'a', the 2nd 'b', and the 3rd 'c'. For row #1 I will compare it's 'a' with all other 'a's. If there isn't another 'a' equal to that, then row #1 changes to [0 0 0]. But if there is another 'a' equal to that one, for instants in row #2, I will compare 'b' #1 and 'c' #2. If they are equal those rows stay the same. If not row #1 changes to [0 0 0]. And so on.