unique
- unique(X) returns X values in ascending order and without duplicates
- [Y, ix, iy] = unique(X) with ix and iy satisfying Y = X(ix) and X = Y(iy)
- unique(X, 'stable') returns X values in the same order as X and without duplicates
Examples
> X = [5 2 3 2 2 4]'# 5 2 3 2 2 4 > [Y, ix, iy] = unique(X) > Y# 2 3 4 5 > ix# 2 3 6 1 > iy# 4 1 2 1 1 3 >> unique(X, 'stable')# 5 2 3 4
> t = table([2;1;2], [9.1;8;9.1], 'Rownames', {'Marie'; 'John'; 'Lewis'}, 'Variablenames', {'ID','Score'}) > unique(t)# ID Score John 1 8 Marie 2 9.1