title: Find indexes of unique in a matlab vector?
body: <p>I have a vector <code>M</code> with possibilities of multiple duplicates, and I want to create an index vector that ignores all the duplicates. I tried <code>[C,ia,ib] = unique(M)</code> but I don't quite know how to use ia and ib.</p>
  
  <p>Edit: Sorry I missed an important detail, <code>I</code> is an existing index vector, it needs to get rid of all index that contain duplicate value. So the original vector looks like <code>M(I)</code> and I want to 'clean up' up <code>I</code>, if I do directly ia = I it won't preserve the original data of I. </p>