@c DO NOT EDIT!  Generated automatically by munge-texi.

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

@node Sets
@chapter Sets

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

@anchor{doc-create_set}
@deftypefn {Function File} {} create_set (@var{x})
Return a row vector containing the unique values in @var{x}, sorted in
ascending order.  For example,

@example
@group
create_set ([ 1, 2; 3, 4; 4, 2 ])
@result{} [ 1, 2, 3, 4 ]
@end group
@end example
@end deftypefn
@seealso{union, intersection, and complement}


@anchor{doc-union}
@deftypefn {Function File} {} union (@var{x}, @var{y})
Return the set of elements that are in either of the sets @var{x} and
@var{y}.  For example,

@example
@group
union ([ 1, 2, 4 ], [ 2, 3, 5 ])
@result{} [ 1, 2, 3, 4, 5 ]
@end group
@end example
@end deftypefn
@seealso{create_set, intersection, and complement}


@anchor{doc-intersection}
@deftypefn {Function File} {} intersection (@var{x}, @var{y})
Return the set of elements that are in both sets @var{x} and @var{y}.
For example,

@example
@group
intersection ([ 1, 2, 3 ], [ 2, 3, 5 ])
@result{} [ 2, 3 ]
@end group
@end example
@end deftypefn
@seealso{create_set, union, and complement}


@anchor{doc-complement}
@deftypefn {Function File} {} complement (@var{x}, @var{y})
Return the elements of set @var{y} that are not in set @var{x}.  For
example,

@example
@group
complement ([ 1, 2, 3 ], [ 2, 3, 5 ])
@result{} 5
@end group
@end example
@end deftypefn
@seealso{create_set, union, and intersection}

