@c Copyright (C) 1994, 1995 John W. Eaton
@c This is part of the Octave manual.
@c For copying conditions, see the file gpl.texi.

@node Sets, Statistics, Signal Processing, Top
@chapter Sets

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

@findex create_set
Given a matrix or vector of values, the function @code{create_set}
returns a row vector containing unique values, sorted in ascending
order.  For example, @samp{create_set ([1, 2; 3, 4; 4, 2])} returns
the vector @samp{[1, 2, 3, 4]}.

@findex union
@findex intersection
The functions @code{union} and @code{intersection} take two sets as
arguments and return the union and interection, respectively.  For
example, @samp{union ([1, 2, 3], [2, 3, 5])} returns the vector
@samp{[1, 2, 5]}.

@findex complement
The function @code{complement (@var{a}, @var{b})} returns the elements
of set @var{b} that are not in set @var{a}.  For example,
@samp{complement ([1, 2, 3], [2, 3, 5])} returns the value @samp{5}.
