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