File: octave_24.html

package info (click to toggle)
octave 2.0.16-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 26,276 kB
  • ctags: 16,450
  • sloc: cpp: 67,548; fortran: 41,514; ansic: 26,682; sh: 7,361; makefile: 4,077; lex: 2,008; yacc: 1,849; lisp: 1,702; perl: 1,676; exp: 123
file content (87 lines) | stat: -rw-r--r-- 1,992 bytes parent folder | download
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
<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.51
     from ./octave.texi on 18 June 1999 -->

<TITLE>GNU Octave - Sets</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="octave_1.html">first</A>, <A HREF="octave_23.html">previous</A>, <A HREF="octave_25.html">next</A>, <A HREF="octave_40.html">last</A> section, <A HREF="octave_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC159" HREF="octave_toc.html#TOC159">Sets</A></H1>

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

</P>

<PRE>
create_set ([ 1, 2; 3, 4; 4, 2 ])
     => [ 1, 2, 3, 4 ]
</PRE>

</DL>

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

</P>

<PRE>
union ([ 1, 2, 4 ], [ 2, 3, 5 ])
     => [ 1, 2, 3, 4, 5 ]
</PRE>

</DL>

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

</P>

<PRE>
intersection ([ 1, 2, 3 ], [ 2, 3, 5 ])
     => [ 2, 3 ]
</PRE>

</DL>

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

</P>

<PRE>
complement ([ 1, 2, 3 ], [ 2, 3, 5 ])
     => 5
</PRE>

</DL>

<P><HR><P>
Go to the <A HREF="octave_1.html">first</A>, <A HREF="octave_23.html">previous</A>, <A HREF="octave_25.html">next</A>, <A HREF="octave_40.html">last</A> section, <A HREF="octave_toc.html">table of contents</A>.
</BODY>
</HTML>