File: octave_28.html

package info (click to toggle)
octave2.1 1%3A2.1.73-13
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 37,028 kB
  • ctags: 20,874
  • sloc: cpp: 106,508; fortran: 46,978; ansic: 5,720; sh: 4,800; makefile: 3,186; yacc: 3,132; lex: 2,892; lisp: 1,715; perl: 778; awk: 174; exp: 134
file content (122 lines) | stat: -rw-r--r-- 4,666 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                      "http://www.w3.org/TR/html40/loose.dtd">
<HTML>
<!-- Created on May, 18 2005 by texi2html 1.66 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<HEAD>
<TITLE>GNU Octave: Sets</TITLE>

<META NAME="description" CONTENT="GNU Octave: Sets">
<META NAME="keywords" CONTENT="GNU Octave: Sets">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.66">

</HEAD>

<BODY LANG="en" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">

<A NAME="SEC182"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_27.html#SEC181"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_29.html#SEC183"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_27.html#SEC181"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_29.html#SEC183"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_42.html#SEC245">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 27. Sets </H1>
<!--docid::SEC182::-->
<P>

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

<A NAME="doc-create_set"></A>
<A NAME="IDX955"></A>
</P>
<DL>
<DT><U>Function File:</U>  <B>create_set</B> <I>(<VAR>x</VAR>)</I>
<DD>Return a row vector containing the unique values in <VAR>x</VAR>, sorted in
ascending order.  For example,
<P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>create_set ([ 1, 2; 3, 4; 4, 2 ])
=> [ 1, 2, 3, 4 ]
</pre></td></tr></table></DL>
<P>

<A NAME="doc-union"></A>
<A NAME="IDX956"></A>
</P>
<DL>
<DT><U>Function File:</U>  <B>union</B> <I>(<VAR>x</VAR>, <VAR>y</VAR>)</I>
<DD>Return the set of elements that are in either of the sets <VAR>x</VAR> and
<VAR>y</VAR>.  For example,
<P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>union ([ 1, 2, 4 ], [ 2, 3, 5 ])
=> [ 1, 2, 3, 4, 5 ]
</pre></td></tr></table></DL>
<P>

<A NAME="doc-intersection"></A>
<A NAME="IDX957"></A>
</P>
<DL>
<DT><U>Function File:</U>  <B>intersection</B> <I>(<VAR>x</VAR>, <VAR>y</VAR>)</I>
<DD>Return the set of elements that are in both sets <VAR>x</VAR> and <VAR>y</VAR>.
For example,
<P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>intersection ([ 1, 2, 3 ], [ 2, 3, 5 ])
=> [ 2, 3 ]
</pre></td></tr></table></DL>
<P>

<A NAME="doc-complement"></A>
<A NAME="IDX958"></A>
</P>
<DL>
<DT><U>Function File:</U>  <B>complement</B> <I>(<VAR>x</VAR>, <VAR>y</VAR>)</I>
<DD>Return the elements of set <VAR>y</VAR> that are not in set <VAR>x</VAR>.  For
example,
<P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>complement ([ 1, 2, 3 ], [ 2, 3, 5 ])
=> 5
</pre></td></tr></table></DL>
<P>

<A NAME="Polynomial Manipulations"></A>
<HR SIZE="6">
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_27.html#SEC181"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_29.html#SEC183"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_42.html#SEC245">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="octave_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
by <I>John W. Eaton</I> on <I>May, 18 2005</I>
using <A HREF="http://texi2html.cvshome.org"><I>texi2html</I></A>
</FONT>

</BODY>
</HTML>