title: How to find the repeated values in a matrix and which rows they belong to?
body: <p>I have a m-by-1 matrix, <code>A</code>. I want to find out which elements are duplicates and get their row values. (Just the row values because the matrix is m-by-1.)</p>
  
  <p>I've tried </p>
  
  <pre><code>k = find(~unique(A));
  </code></pre>
  
  <p>but k contains the wrong values.</p>
  
  <p>Here's an example of what I'm trying to do. Consider the array A;</p>
  
  <pre><code>A = [4
       5
       5
       5
       7
       8
       4];
  </code></pre>
  
  <p>Since 4 and 5 are the repeated elements here, I would like to get the row values of these elements and put them in a new array. The resulting array would be</p>
  
  <pre><code>RowValues= [1
              2
              3
              4
              7];
  </code></pre>
  
  <p>Note: The above is just an example and the actual array I am dealing with contains rational numbers of the type -0.0038, 1.3438 and so on in the array <code>A</code>.</p>