comparison doc/interpreter/set.txi @ 3294:bfe1573bd2ae

[project @ 1999-10-19 10:06:07 by jwe]
author jwe
date Tue, 19 Oct 1999 10:08:42 +0000
parents
children a4cd1e9d9962
comparison
equal deleted inserted replaced
3293:58950f032a06 3294:bfe1573bd2ae
1 @c Copyright (C) 1996, 1997 John W. Eaton
2 @c This is part of the Octave manual.
3 @c For copying conditions, see the file gpl.texi.
4
5 @node Sets, Polynomial Manipulations, Statistics, Top
6 @chapter Sets
7
8 Octave has a limited set of functions for managing sets of data, where a
9 set is defined as a collection unique elements.
10
11 @deftypefn {Function File} {} create_set (@var{x})
12 Return a row vector containing the unique values in @var{x}, sorted in
13 ascending order. For example,
14
15 @example
16 @group
17 create_set ([ 1, 2; 3, 4; 4, 2 ])
18 @result{} [ 1, 2, 3, 4 ]
19 @end group
20 @end example
21 @end deftypefn
22
23 @deftypefn {Function File} {} union (@var{x}, @var{y})
24 Return the set of elements that are in either of the sets @var{x} and
25 @var{y}. For example,
26
27 @example
28 @group
29 union ([ 1, 2, 4 ], [ 2, 3, 5 ])
30 @result{} [ 1, 2, 3, 4, 5 ]
31 @end group
32 @end example
33 @end deftypefn
34
35 @deftypefn {Function File} {} intersection (@var{x}, @var{y})
36 Return the set of elements that are in both sets @var{x} and @var{y}.
37 For example,
38
39 @example
40 @group
41 intersection ([ 1, 2, 3 ], [ 2, 3, 5 ])
42 @result{} [ 2, 3 ]
43 @end group
44 @end example
45 @end deftypefn
46
47 @deftypefn {Function File} {} complement (@var{x}, @var{y})
48 Return the elements of set @var{y} that are not in set @var{x}. For
49 example,
50
51 @example
52 @group
53 complement ([ 1, 2, 3 ], [ 2, 3, 5 ])
54 @result{} 5
55 @end group
56 @end example
57 @end deftypefn