[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

# 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"`

.

26.1 Set Operations |