unique - extract unique components of a vector
unique(M) returns a vector which retains the unique entries of M in ascending order.
If required the output argument k contains the position of the first encountered unique entries.
M=round(2*rand(20,1)); unique(M) [N,k]=unique(M) unique(string(M)) [N,k]=unique(string(M))