You must return unique values in a vector in stable mode without using the unique function.
About stable order flag:
C = unique([5 5 3 4],'stable') returns C = [5 3 4].
The values are returned in the same order as in the original vector
Doc of the Unique function here