## 26 Sets

Octave has a limited number of functions for managing sets of data, where a set is defined as a collection of unique elements. In Octave a set is represented as a vector of numbers.

— Function File: unique (x)
— Function File: unique (x, "rows")
— Function File: unique (..., "first")
— Function File: unique (..., "last")
— Function File: [y, i, j] = unique (...)

> Return the unique elements of x, sorted in ascending order. If x is a row vector, return a row vector, but if x is a column vector or a matrix return a column vector.

> If the optional argument `"rows"` is supplied, return the unique rows of x, sorted in ascending order.

> If requested, return index vectors i and j such that `x(i)==y` and `y(j)==x`.

> Additionally, one of `"first"` or `"last"` may be given as an argument. If `"last"` is specified, return the highest possible indices in i, otherwise, if `"first"` is specified, return the lowest. The default is `"last"`.

> See also: union, intersect, setdiff, setxor, ismember.