## 27 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 the input x is a vector then the output is also a vector with the same orientation (row or column) as the input. For a matrix input the output is always a column vector. x may also be a cell array of strings.

> 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, if i is a requested output then one of `"first"` or `"last"` may be given as an input. 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.