I'm trying to transfer MATLAB code to Python, but couldn't find an implementation to replace the function unique in MATLAB.
In the original MATLAB code, unique() is used as:
[c,ia,ic]=unique(a,'stable')
c is an array with unique elements and has the same sequence as a.
I know in numpy there is an implementation
c,ic = np.unique(a,return_reverse=True)
This function returns a sorted array c, but I prefer c to have the original sequence as a with unique elements.
And ic is what I really want. I'm trying to use ic to locate some value in A.