title: What is the easiest/ computationally efficient way to find the indexes at particular locations?
body: <p>I have a matrix </p>
  
  <pre><code>m =
  
   2     2     1
   3     2     1
   0     4     1
   0     4     1
   5     4     1
   0     5     2
   1     2     2
   1     3     2
   1     4     2
   1     1     3
   0     2     3
   0     3     4
   0     3     4 
  </code></pre>
  
  <p>that is potentially of N x 3, where N can be very large.</p>
  
  <p>I want to find the index in the first column (1-13) where i have zeros but only if there are duplicate rows or the rows are unique. I don't want rows that the 2nd and 3rd column are the same but the first column is other than zero. In other words, if there is a zero at the first column but its corresponding number in the second and third column are the same with another one that has a different number other than zero in the first column, then ignore the index of that zero.   So, in the example above, i want to return only the indices 6, 11,12, 13. Index 3,4 should not be return because they violate the rule that there is a row similar to that (2nd and 3rd column) but the first column is different, as we can see below: </p>
  
  <pre><code> 0     4     1
   0     4     1
   5     4     1
  </code></pre>
  
  <p>One slow solution would be to find the indices of the rows that the first column is 0 <code>indm=m(:,1)==0</code> and then iterate over the rows of the matrix checking whether any other row exists in  matrix (<code>m</code>) that has identical 2nd and 3rd columns but different 1st column. If such case does not exist then add the index of the row to the list to be returned by the program. 
  However, this method, would require "for loops" going over large matrices. </p>