annotate doc/faq/Octave-FAQ.texi @ 6653:673686daec87

[project @ 2007-05-22 15:36:09 by jwe]
author jwe
date Tue, 22 May 2007 15:36:10 +0000
parents 89f3a84a0da1
children 19e2d70e2a4c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
1 \input texinfo.tex @c -*-texinfo-*-
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
2
3030
353071b4970b [project @ 1997-06-05 07:31:36 by jwe]
jwe
parents: 2866
diff changeset
3 @setfilename Octave-FAQ.info
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
4 @settitle Frequently asked questions about Octave (with answers)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
5
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
6 @setchapternewpage off
5099
f7e39f977fe8 [project @ 2004-12-24 19:06:01 by jwe]
jwe
parents: 5041
diff changeset
7 @direntry
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
8 * Octave-FAQ: (Octave-FAQ). Frequently asked questions about Octave
5099
f7e39f977fe8 [project @ 2004-12-24 19:06:01 by jwe]
jwe
parents: 5041
diff changeset
9 @end direntry
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
10 @titlepage
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
11 @title Octave FAQ
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
12 @subtitle Frequently asked questions about Octave
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
13 @subtitle April, 2007
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
14 @sp 1
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
15 @author John W. Eaton
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
16 @page
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
17 @end titlepage
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
18
5423
6cd1c2fc4dab [project @ 2005-07-28 19:27:57 by jwe]
jwe
parents: 5099
diff changeset
19 @ifnottex
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
20 @node Top
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
21 @top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
22 @unnumbered Preface
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
23 @cindex FAQ for Octave, latest version
5423
6cd1c2fc4dab [project @ 2005-07-28 19:27:57 by jwe]
jwe
parents: 5099
diff changeset
24 @end ifnottex
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
25
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
26 This is a list of frequently asked questions (FAQ) for Octave users.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
27
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
28 We are always looking for new questions (@emph{with} answers), better
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
29 answers, or both. Please send suggestions to @email{bug@@octave.org}.
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
30 If you have general questions about Octave, or need help for something
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
31 that is not covered by the Octave manual or the FAQ, please use the
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
32 @email{help@@octave.org} mailing list.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
33
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
34 This FAQ is intended to supplement, not replace, the Octave manual.
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
35 Before posting a question to the @email{help@@octave.org} mailing list,
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
36 you should first check to see if the topic is covered in the manual.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
37
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
38 @menu
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
39 * What is Octave?::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
40 * How can I cite Octave?::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
41 * Series 2.9.N::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
42 * Octave Features::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
43 * Learning more about Octave::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
44 * Getting Octave::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
45 * Installation::
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
46 * Common problems::
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
47 * How do I ...?::
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
48 * MATLAB compatibility::
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
49 * Index::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
50 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
51
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
52 @node What is Octave?
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
53 @chapter What is Octave?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
54
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
55 Octave is a high-level interactive language, primarily intended for
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
56 numerical computations that is mostly compatible with
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
57 @sc{Matlab}.@footnote{@sc{Matlab} is a registered trademark of The MathWorks,
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
58 Inc.}
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
59
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
60 Octave can do arithmetic for real, complex or integer-valued scalars
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
61 and matrices, solve sets of nonlinear algebraic equations, integrate
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
62 functions over finite and infinite intervals, and integrate systems of
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
63 ordinary differential and differential-algebraic equations.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
64
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
65 Octave uses the GNU readline library to handle reading and editing
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
66 input. By default, the line editing commands are similar to the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
67 cursor movement commands used by GNU Emacs, and a vi-style line
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
68 editing interface is also available. At the end of each session, the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
69 command history is saved, so that commands entered during previous
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
70 sessions are not lost.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
71
6606
2c19eaa2c6f7 [project @ 2007-05-07 17:09:38 by jwe]
jwe
parents: 6584
diff changeset
72 The Octave distribution includes a 550+ page Texinfo manual. Access
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
73 to the complete text of the manual is available via the help command
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
74 @c really, the *complete* text?
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
75 at the Octave prompt.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
76
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
77 @menu
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
78 * Who develops Octave?::
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
79 * Why GNU Octave?::
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
80 * What version should I use?::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
81 * On what platforms does Octave run?::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
82 @end menu
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
83
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
84 @node Who develops Octave?
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
85 @section Who develops Octave?
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
86
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
87 Discussions about writing the software that would eventually become
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
88 Octave started in about 1988 with James B. Rawlings and John W. Eaton at
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
89 the University of Texas. John W. Eaton was the original author of
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
90 Octave, starting full-time development in February 1992. He is still
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
91 the primary maintainer. The community
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
92 of users/developers has in addition contributed some code and fuels the
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
93 discussion on the mailing lists @email{help@@octave.org} (user forum),
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
94 @email{bug@@octave.org} (bug reports), @email{maintainers@@octave.org}
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
95 (development issues), and @email{octave-dev@@lists.sourceforge.net} (all
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
96 things related to the Octave Forge repository of user-contributed
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
97 functions).
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
98
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
99 @node Why GNU Octave?
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
100 @section Why GNU Octave?
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
101
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
102 The GNU Project was launched in 1984 to develop a complete Unix-like
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
103 operating system which is free software: the GNU system.
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
104
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
105 GNU is a recursive acronym for ``GNU's Not Unix''; it is pronounced
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
106 guh-noo, approximately like canoe.
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
107
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
108 The Free Software Foundation (FSF) is the principal organizational
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
109 sponsor of the GNU Project.
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
110
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
111 Octave became GNU Octave in 1997 (beginning with version 2.0.6). This
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
112 meant agreeing to consider Octave a part of the GNU Project and support
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
113 the efforts of the FSF. However, Octave is not and has never been
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
114 developed by the FSF.
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
115
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
116 For more information about the GNU project, see @url{www.gnu.org}.
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
117
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
118 @cindex FSF [Free Software Foundation]
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
119 @cindex GNU [GNU's not unix]
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
120
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
121 @node What version should I use?
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
122 @section What version should I use?
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
123
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
124 In general, you will find the latest version on
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
125 @url{http://www.octave.org/download.html}. It is
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
126 recommended to use the ``testing'' version of octave for general use,
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
127 and the ``development'' version if you want the latest features.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
128
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
129 A list of user-visible changes since the last release is available in
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
130 the file @file{NEWS}. The file @file{ChangeLog} in the source
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
131 distribution contains a more detailed record of changes made since the
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
132 last release.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
133
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
134 @node On what platforms does Octave run?
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
135 @section On what platforms does Octave run?
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
136
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
137 Octave runs on various Unices---at least Linux and Solaris, Mac OS X,
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
138 Windows and anything you can compile it on. Binary distributions exist
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
139 at least for Debian, Suse, Fedora and RedHat Linuxes (Intel and AMD
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
140 CPUs, at least), for Mac Os X and Windows' 98, 2000 and XP.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
141
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
142 Two and three dimensional plotting is fully supported using gnuplot.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
143
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
144 The underlying numerical solvers are currently standard Fortran ones
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
145 like Lapack, Linpack, Odepack, the Blas, etc., packaged in a library
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
146 of C++ classes. If possible, the Fortran subroutines are compiled
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
147 with the system's Fortran compiler, and called directly from the C++
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
148 functions. If that's not possible, you can still compile Octave if
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
149 you have the free Fortran to C translator f2c.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
150
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
151 Octave is also free software; you can redistribute it and/or modify it
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
152 under the terms of the GNU General Public License as published by the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
153 Free Software Foundation.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
154
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
155 @node How can I cite Octave?
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
156 @chapter How can I cite Octave?
4831
4ec7d24b4943 [project @ 2004-03-10 06:14:52 by jwe]
jwe
parents: 4830
diff changeset
157
4ec7d24b4943 [project @ 2004-03-10 06:14:52 by jwe]
jwe
parents: 4830
diff changeset
158 Pointing to @url{http://www.octave.org} is good, because that gives
4ec7d24b4943 [project @ 2004-03-10 06:14:52 by jwe]
jwe
parents: 4830
diff changeset
159 people a direct way to find out more. If citation of a URL is not
4ec7d24b4943 [project @ 2004-03-10 06:14:52 by jwe]
jwe
parents: 4830
diff changeset
160 allowed by a publisher, or if you also want to point to a traditional
4ec7d24b4943 [project @ 2004-03-10 06:14:52 by jwe]
jwe
parents: 4830
diff changeset
161 reference, then you can cite the Octave manual:
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
162
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
163 @example
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
164 @group
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
165 @@BOOK@{eaton:2002,
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
166 author = "John W. Eaton",
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
167 title = "GNU Octave Manual",
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
168 publisher = "Network Theory Limited",
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
169 year = "2002",
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
170 isbn = "0-9541617-2-6"
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
171 @}
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
172 @end group
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
173 @end example
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
174
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
175 @node Series 2.9.N
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
176 @chapter What's new in version series 2.9.N of Octave
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
177
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
178 The 2.9.N series, started in March 2005, has enough new features to
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
179 justify a major version number change. Version 2.9.10 is nearly as
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
180 stable as the latest 2.1.N releases and stability should increase as
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
181 one gets near version 3.0.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
182
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
183 Series 2.9.N brings
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
184
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
185 @itemize @bullet
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
186
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
187 @item integer types
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
188
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
189 @item fixed point arithmetic
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
190
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
191 @item sparse matrices
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
192
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
193 @item Linear programming code based on GLPK
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
194
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
195 @item 64-bit compilation support
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
196
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
197 @item gzipped files and stream and consequently support of matlab v7 files
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
198
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
199 @item better support for both msvc and mingw
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
200
6606
2c19eaa2c6f7 [project @ 2007-05-07 17:09:38 by jwe]
jwe
parents: 6584
diff changeset
201 @item a fully compatiable MEX interface
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
202
6606
2c19eaa2c6f7 [project @ 2007-05-07 17:09:38 by jwe]
jwe
parents: 6584
diff changeset
203 @item many many other minor features and compatibility changes
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
204
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
205 @end itemize
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
206
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
207 Here are some features that have been around since 2.1.NN
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
208
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
209 @itemize @bullet
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
210
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
211 @item NDarrays
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
212
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
213 @item cells
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
214
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
215 @end itemize
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
216
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
217 @node Octave Features
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
218 @chapter What features are unique to Octave?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
219
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
220 @menu
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
221 * Functions defined on the command-line::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
222 * Comments with #::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
223 * Strings delimitted by double quotes "::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
224 * Line continuation by backslash::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
225 * Informative block closing::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
226 * Coherent syntax::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
227 * Exclamation mark as not operator::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
228 @c * Short-circuit boolean operators::
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
229 * Increment and decrement operators::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
230 * Unwind-protect::
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
231 * Built-in ODE and DAE solvers::
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
232 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
233
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
234 This section refers to Matlab 6,5.0 R 13 and Octave 2.9.10.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
235
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
236 @node Functions defined on the command-line
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
237 @section Functions defined on the command-line
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
238
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
239 Functions can be defined by entering code on the command line, a
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
240 feature not supported by the other leading brand. For example, you may
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
241 type:
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
242
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
243 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
244 @group
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
245 octave:1> function s = hello_string (to_who)
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
246 > ## Say hello
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
247 > if nargin<1, to_who = "World"; end
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
248 > s = ["Hello ",\
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
249 > to_who];
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
250 > endfunction
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
251 octave:2> hello_string ("Moon")
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
252 ans = Hello Moon
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
253 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
254 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
255
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
256 @node Comments with #
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
257 @section Comments with #
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
258
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
259 The pound character, @samp{#}, may be used to start comments, in addition
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
260 to @samp{%}. See the previous example. The major advantage of this is
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
261 that as @samp{#} is also a comment character for unix script files, any
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
262 file that starts with a string like @samp{#! /usr/bin/octave -q} will be
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
263 treated as an octave script and be executed by octave.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
264
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
265 @node Strings delimitted by double quotes "
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
266 @section Strings delimitted by double quotes "
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
267 The double quote, @samp{"}, may be used to delimit strings, in addition to
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
268 the single quote @samp{'}. See the previous example. Also, double-quoted
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
269 strings include backslash interpretation (like C++, C, and Perl) while
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
270 single quoted are uninterpreted (like Matlab and Perl).
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
271
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
272 @node Line continuation by backslash
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
273 @section Line continuation by backslash
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
274
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
275 Lines can be continued with a backslash, @samp{\}, in addition to three
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
276 points @samp{@dots{}}. See the previous example.
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
277
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
278 @node Informative block closing
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
279 @section Informative block closing
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
280
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
281 You may close @code{function}, @code{for}, @code{while}, @code{if},
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
282 @dots{} blocks with @code{endfunction}, @code{endfor}, @code{endwhile},
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
283 @dots{} keywords in addition to using @code{end}. As with Matlab, the
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
284 @code{end} (or @code{endfunction}) keyword that marks the end of a
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
285 function defined in a @file{.m} file is optional.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
286
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
287 @node Coherent syntax
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
288 @section Coherent syntax
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
289
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
290 Indexing other things than variables is possible, as in:
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
291 @example
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
292 @group
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
293 octave:1> [3 1 4 1 5 9](3)
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
294 ans = 4
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
295 octave:2> cos([0 pi pi/4 7])(3)
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
296 ans = 0.70711
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
297 @end group
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
298 @end example
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
299
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
300 @node Exclamation mark as not operator
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
301 @section Exclamation mark as not operator
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
302
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
303 The exclamation mark '!' (aka ``Bang!'') is a negation operator, just
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
304 like the tilde '~':
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
305
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
306 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
307 @group
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
308 octave:1> if ! strcmp (program_name, "octave"),
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
309 > "It's an error"
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
310 > else
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
311 > "It works!"
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
312 > end
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
313 ans = It works!
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
314 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
315 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
316
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
317 @node Increment and decrement operators
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
318 @section Increment and decrement operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
319
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
320 @cindex Increment operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
321 @cindex Decrement operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
322 @cindex Operators, increment
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
323 @cindex Operators, decrement
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
324
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
325 If you like the @samp{++}, @samp{+=} etc operators, rejoice!
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
326 Octave includes the C-like increment and decrement operators @samp{++}
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
327 and @samp{--} in both their prefix and postfix forms, in addition to
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
328 @samp{+=}, @samp{-=}, @samp{*=}, @samp{/=}, @samp{^=}, @samp{.*=},
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
329 @samp{./=}, and @samp{.^=}.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
330
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
331 For example, to pre-increment the variable @var{x}, you would write
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
332 @code{++@var{x}}. This would add one to @var{x} and then return the new
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
333 value of @var{x} as the result of the expression. It is exactly the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
334 same as the expression @code{@var{x} = @var{x} + 1}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
335
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
336 To post-increment a variable @var{x}, you would write @code{x++}.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
337 This adds one to the variable @var{x}, but returns the value that
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
338 @var{x} had prior to incrementing it. For example, if @var{x} is equal
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
339 to 2, the result of the expression @code{x++} is 2, and the new
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
340 value of @var{x} is 3.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
341
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
342 For matrix and vector arguments, the increment and decrement operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
343 work on each element of the operand.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
344
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
345
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
346 @node Unwind-protect
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
347 @section Unwind-protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
348
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
349 @cindex Unwind-protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
350
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
351 Octave supports a limited form of exception handling modelled after the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
352 unwind-protect form of Lisp. The general form of an
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
353 @code{unwind_protect} block looks like this:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
354
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
355 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
356 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
357 unwind_protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
358 @var{body}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
359 unwind_protect_cleanup
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
360 @var{cleanup}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
361 end_unwind_protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
362 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
363 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
364
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
365 @noindent
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
366 Where @var{body} and @var{cleanup} are both optional and may contain any
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
367 Octave expressions or commands. The statements in @var{cleanup} are
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
368 guaranteed to be executed regardless of how control exits @var{body}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
369
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
370 The @code{unwind_protect} statement is often used to reliably restore
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
371 the values of global variables that need to be temporarily changed.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
372
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
373 @node Built-in ODE and DAE solvers
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
374 @section Built-in ODE and DAE solvers
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
375
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
376 @cindex DASSL
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
377 @cindex LSODE
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
378
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
379 Octave includes LSODE and DASSL for solving systems of stiff ordinary
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
380 differential and differential-algebraic equations. These functions are
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
381 built in to the interpreter.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
382
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
383 @node Learning more about Octave
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
384 @chapter What documentation exists for Octave?
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
385
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
386 @menu
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
387 * Documentation::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
388 * Getting additional help::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
389 * User community::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
390 * Bug reports::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
391 @end menu
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
392
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
393
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
394 @node Documentation
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
395 @section What documentation exists for Octave?
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
396
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
397 @cindex Octave, documentation
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
398
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
399 The Octave distribution includes a 550+ page manual that is also
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
400 distributed under the terms of the GNU GPL.
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
401 It is available on the web at
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
402 @url{http://www.octave.org/docs.html} and you will also
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
403 find there instructions on how to order a paper version.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
404
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
405 The complete text of the Octave manual is also available using the GNU
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
406 Info system via the GNU Emacs, info, or xinfo programs, or by using
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
407 the @samp{help -i} command to start the GNU info browser directly from
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
408 the Octave prompt.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
409
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
410 If you have problems using this documentation, or find that some topic
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
411 is not adequately explained, indexed, or cross-referenced, please send
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
412 a bug report to @email{bug@@octave.org}.
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
413
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
414
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
415 @node Getting additional help
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
416 @section Getting additional help
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
417
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
418 @cindex Additional help
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
419 @cindex Mailing lists, help-octave
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
420
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
421 If you can't find an answer to your question, the
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
422 @email{help@@octave.org} mailing list is available for questions related
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
423 to using, installing, and porting Octave that are not adequately
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
424 answered by the Octave manual or by this document.
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
425
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
426 @node User community
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
427 @section User community
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
428
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
429 To subscribe to the list, go to @url{www.octave.org/archive.html} and
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
430 follow the link to the subscription page for the list.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
431
6653
673686daec87 [project @ 2007-05-22 15:36:09 by jwe]
jwe
parents: 6612
diff changeset
432 @strong{Please do not} send requests to be added or removed from the
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
433 mailing list, or other administrative trivia to the list itself.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
434
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
435 An archive of old postings to the help-octave mailing list is maintained
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
436 on @url{http://www.octave.org/archive.html}.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
437
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
438 You will also find some user advice and code spread over the web. Good
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
439 starting points are the Octave Wiki @url{http://wiki.octave.org} and
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
440 Octave-Forge @url{htt://octave.sourceforge.net}
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
441
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
442 @node Bug reports
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
443 @section I think I have found a bug in Octave.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
444
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
445 @cindex Bug in Octave, newly found
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
446
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
447 ``I think I have found a bug in Octave, but I'm not sure. How do I know,
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
448 and who should I tell?''
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
449
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
450 @cindex Manual, for Octave
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
451
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
452 First, see the section on bugs and bug reports in the Octave manual.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
453 When you report a bug, make sure to describe the type of computer you
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
454 are using, the version of the operating system it is running, and the
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
455 version of Octave that you are using. Also provide enough code so that
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
456 the Octave maintainers can duplicate your bug.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
457
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
458 If you have Octave working at all, the easiest way to do this is to use
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
459 the Octave function @code{bug_report}. When you execute this function,
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
460 Octave will prompt you for a subject and then invoke the editor on a
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
461 file that already contains all the configuration information. When you
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
462 exit the editor, Octave will mail the bug report for you (in a unix-like
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
463 operating system).
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
464
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
465 @cindex Octave bug report
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
466 @cindex Mailing lists, bug-octave
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
467
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
468 If for some reason you cannot use Octave's @code{bug_report} function,
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
469 mail your bug report to @email{bug@@octave.org}. Your message needs to
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
470 include enough information to allow the maintainers of Octave to fix the
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
471 bug. Please read the section on bugs and bug reports in the Octave
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
472 manual for a list of things that should be included in every bug report.
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
473
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
474
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
475 @node Getting Octave
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
476 @chapter Getting Octave
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
477
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
478 @menu
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
479 * Source code::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
480 * Pre-compiled binary packages::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
481 * Octave for other platforms::
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
482 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
483
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
484 @node Source code
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
485 @section Source code
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
486 @cindex Source code
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
487
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
488 Source code is available on the Octave development site, where you are
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
489 sure to get the latest version.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
490
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
491 @itemize @bullet
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
492 @item @url{http://www.octave.org/download.html}
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
493 @item @url{ftp://ftp.octave.org/pub/octave/}
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
494 @end itemize
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
495
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
496 Since Octave is distrubted under the terms of the GPL, you can get
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
497 Octave from a friend who has a copy, by anonymous FTP, or by ordering
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
498 a tape or CD-ROM from the Free Software Foundation (FSF).
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
499
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
500 @node Pre-compiled binary packages
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
501 @section Pre-compiled binary packages
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
502 @cindex Pre-compiled binary packages
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
503 @cindex Binaries
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
504
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
505 The Octave project does not distribute binary packages, but other
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
506 projects do. For an up-to-date listing of packagers, see:
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
507
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
508 @itemize @bullet
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
509 @item @url{http://www.octave.org/download.html}
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
510 @item @url{http://wiki.octave.org/wiki.pl?CategoryInstall}
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
511 @end itemize
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
512
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
513 As of today, Octave binaries are available at least on Debian, RedHat,
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
514 Suse and Fedora Linuxes, Mac OS X, Windows' 98, 2000 and XP.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
515
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
516 @node Octave for other platforms
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
517 @section How do I get a copy of Octave for (some other platform)?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
518
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
519 @cindex VMS support
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
520 @cindex VAX
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
521 @cindex MS-DOS support
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
522 @cindex Windows support
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
523 @cindex DJGPP
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
524 @cindex EMX
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
525 @cindex OS/2 support
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
526
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
527 Octave currently runs on Unix-like systems, Mac OS X, and Windows
3840
79474340b3a1 [project @ 2001-06-17 02:17:33 by jwe]
jwe
parents: 3285
diff changeset
528 (using the Cygwin tools from Red Hat). It should be possible
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
529 to make Octave work on other systems as well. If you are interested in
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
530 porting Octave to other systems, please contact
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
531 @email{bug@@octave.org}.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
532
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
533 @c @menu
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
534 @c * Octave for Unix::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
535 @c * Octave for other platforms::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
536 @c * latest versions::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
537 @c @end menu
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
538
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
539 @c @cindex Octave, ordering
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
540 @c @cindex Octave, getting a copy
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
541
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
542 @node Installation
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
543 @chapter Installation Issues and Problems
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
544
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
545 @cindex Octave, building
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
546
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
547 Octave 2.9.10 requires approximately 800MB of disk storage to unpack
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
548 and compile from source (considerably less if you don't compile with
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
549 debugging symbols). Once installed, Octave requires approximately 200MB
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
550 of disk space (again, considerably less if you don't compile with
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
551 debugging symbols).
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
552
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
553 @menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
554 * What else do I need?::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
555 * Other C++ compilers?::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
556 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
557
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
558 @node What else do I need?
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
559 @section What else do I need?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
560
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
561 @cindex GNU gcc
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
562 @cindex GNU g++
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
563 @cindex libg++
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
564 @cindex GNU Make
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
565 @cindex Flex
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
566 @cindex GNU Bison
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
567
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
568 To compile Octave, you will need a recent version of GNU Make. You
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
569 will also need GCC 3.3 or later, although GCC 4.1 or later is
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
570 recommended.
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
571
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
572 @strong{You must have GNU Make to compile octave}. Octave's Makefiles
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
573 use features of GNU Make that are not present in other versions of make.
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
574 GNU Make is very portable and easy to install.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
575
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
576 @node Other C++ compilers?
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
577 @section Can I compile Octave with another C++ compiler?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
578
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
579 Yes, but development is done primarily with GCC, so you may hit some
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
580 incompatibilities. Octave is intended to be portable to any standard
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
581 conforming compiler. If you have difficulties that you think are bugs,
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
582 please report them to the @email{bug@@octave.org} mailing list, or ask
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
583 for help on the @email{help@@octave.org} mailing list.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
584
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
585 @node Common problems
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
586 @chapter Common problems
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
587
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
588 This list is probably far too short. Feel free to suggest additional
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
589 questions (preferably with answers!)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
590
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
591 @itemize @bullet
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
592 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
593 Octave takes a long time to find symbols.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
594
6606
2c19eaa2c6f7 [project @ 2007-05-07 17:09:38 by jwe]
jwe
parents: 6584
diff changeset
595 Octave uses the @code{genpath} function to recursively add directories
2c19eaa2c6f7 [project @ 2007-05-07 17:09:38 by jwe]
jwe
parents: 6584
diff changeset
596 to the list of directories searched for function files. Check the list
2c19eaa2c6f7 [project @ 2007-05-07 17:09:38 by jwe]
jwe
parents: 6584
diff changeset
597 of directories with the @code{path} command. If the path list is very
2c19eaa2c6f7 [project @ 2007-05-07 17:09:38 by jwe]
jwe
parents: 6584
diff changeset
598 long check your use of the @code{genpath} function.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
599 @end itemize
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
600
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
601 @node How do I ...?
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
602 @chapter How do I ...?
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
603
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
604 @menu
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
605 * How do I set the number of displayed decimals?::
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
606 @end menu
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
607
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
608 @cindex Tips and tricks
6584
cd06796e0ed6 [project @ 2007-04-26 15:41:29 by jwe]
jwe
parents: 6583
diff changeset
609 @cindex How do I @dots{} ?
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
610
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
611 @node How do I set the number of displayed decimals?
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
612 @section How do I set the number of displayed decimals?
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
613
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
614
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
615 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
616 @group
6583
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
617 octave:1> format long
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
618 octave:2> pi
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
619 pi = 3.14159265358979
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
620 octave:3> format short
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
621 octave:4> pi
e4ef75fe0bf2 [project @ 2007-04-26 04:01:08 by jwe]
jwe
parents: 6477
diff changeset
622 pi = 3.1416
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
623 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
624 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
625
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
626 @node MATLAB compatibility
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
627 @chapter Porting programs from @sc{Matlab} to Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
628
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
629 @cindex @sc{Matlab} compatibility
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
630 @cindex Compatibility with @sc{Matlab}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
631
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
632 People often ask
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
633
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
634 ``I wrote some code for @sc{Matlab}, and I want to get it running under
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
635 Octave. Is there anything I should watch out for?''
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
636
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
637 or alternatively
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
638
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
639 ``I wrote some code in Octave, and want to share it with @sc{Matlab}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
640 users. Is there anything I should watch out for?''
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
641
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
642 which is not quite the same thing. There are still a number of
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
643 differences between Octave and @sc{Matlab}, however in general
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
644 differences between the two are considered as bugs. Octave might
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
645 consider that the bug is in @sc{Matlab} and do nothing about it, but
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
646 generally functionality is almost identical. If you find a difference
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
647 between Octave behavior and @sc{Matlab}, then you should send a
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
648 description of this difference (with code illustrating the difference,
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
649 if possible) to @email{bug@@octave.org}.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
650
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
651 Furthermore, Octave adds a few syntactical extensions to Matlab that
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
652 might cause some issues when exchanging files between Matlab and Octave
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
653 users. As both Octave and @sc{Matlab} are under constant development the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
654 information in this section is subject to change at anytime.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
655
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
656 You should also look at the page
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
657 @url{http://octave.sourceforge.net/packages.html} and
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
658 @url{http://octave.sourceforge.net/doc/} that has a function reference
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
659 that is up to date. You can use this function reference to see the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
660 number of octave function that are available and their @sc{Matlab}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
661 compatibility.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
662
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
663 The major differences between Octave 2.9.10 and @sc{Matlab} v7.3 are:
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
664
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
665 @itemize @bullet
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
666 @item Nested Functions
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
667
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
668 Octave doesn't yet have nested functions. That if
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
669
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
670 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
671 @group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
672 function y = foo (x)
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
673 y = bar(x)
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
674 function y = bar (x)
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
675 y = @dots{};
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
676 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
677 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
678 @end group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
679 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
680
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
681 There was discussion in Octave of having these even prior to @sc{Matlab},
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
682 and the decision was made not to have these in Octave at the time for
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
683 compatibility. The above written with sub-functions functions would be
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
684
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
685 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
686 @group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
687 function y = foo (x)
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
688 y = bar(x)
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
689 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
690 function y = bar (x)
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
691 y = @dots{};
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
692 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
693 @end group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
694 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
695
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
696 Now that @sc{Matlab} has recently introduced nested functions, Octave will
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
697 probably have them soon as well. Till then nested functions in Octave
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
698 are treated as sub-functions with the same scoping rules as
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
699 sub-functions.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
700
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
701 The authors of Octave consider the nested function scoping rules of
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
702 Matlab to be more problems than they are worth as they introduce
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
703 diffiult to find bugs as inadvertantly modifying a variable in a
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
704 nested function that is also used in the parent is particularly easy.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
705
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
706 @item Differences in core syntax
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
707
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
708 There a few core @sc{Matlab} syntaxes that are not accepted by Octave,
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
709 these being
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
710
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
711 @itemize @bullet
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
712 @item
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
713 Some limitations on the use of function handles. The major difference is
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
714 related to nested function scoping rules (as above) and there use with
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
715 function handles.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
716
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
717 @item
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
718 Some limitations of variable argument lists on the LHS of an expression,
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
719 though the most common types are accepted.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
720
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
721 @item
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
722 @sc{Matlab} object-oriented classes with overloading etc through the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
723 subasgn and "@@" directories is not treated by Octave. There is work to
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
724 remove this restriction in the future.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
725
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
726 @item
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
727 @sc{Matlab} private directories are not treated, though as for classes,
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
728 this will change in the near future. This restriction alleviated by
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
729 using addpath on the private directories, but this makes the private
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
730 directories visible in the global scope.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
731 @end itemize
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
732
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
733 @item Differences in core functions
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
734
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
735 A large number of the @sc{Matlab} core functions (ie those that are in
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
736 the core and not a toolbox) are implemented, and certainly all of the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
737 commonly used ones. There are a few functions that aren't implemented,
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
738 for example condest or to do with specific missing Octave functionality
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
739 (gui, dll, java, activex, dde, web, and serial functions). Some of the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
740 core functions have limitations that aren't in the @sc{Matlab}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
741 version. For example the interpN function can only do linear
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
742 interpolation and not cubic spline, etc.. However the interp and interp2
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
743 function can.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
744
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
745 @item Just-In-Time compiler
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
746
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
747 @sc{Matlab} includes a "Just-In-Time" compiler. This compiler allows the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
748 acceleration of for-loops in @sc{Matlab} to almost native performance with
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
749 certain restrictions. The JIT must know the return type of all functions
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
750 called in the loops and so you can't include user functions in the loop
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
751 of JIT optimized loops. Octave doesn't have a JIT and so to some might
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
752 seem slower than @sc{Matlab}. For this reason you must vectorize your code as
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
753 much as possible. @sc{Matlab} themselves produces a good document discussing
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
754 vectorization at
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
755 @url{http://www.mathworks.com/support/tech-notes/1100/1109.html}.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
756
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
757 @item Compiler
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
758
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
759 On a related point, there is no Octave compiler, and so you can't
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
760 convert your Octave code into a binary for additional speed or
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
761 distribution. There is an example of how to do this at
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
762 @url{http://www.stud.tu-ilmenau.de/~rueckn/}, but this is a very early
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
763 example code and would need lots of work to complete it.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
764
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
765 @item Graphic Handles
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
766
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
767 Up to Octave 2.9.9 there was no support for graphic handles in Octave
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
768 itself. There is in Octave 2.9.10 and later, and so the graphics between
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
769 Octave and @sc{Matlab} are currently in the process of converging to a
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
770 common interface. Note that the basic graphic handle stuff is in place
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
771 in 2.9.10, but not graphics objects like "patch", "barseries", etc.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
772
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
773 @item GUI
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
774
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
775 There is no @sc{Matlab} compatible GUI functions. There are a number of
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
776 bindings from Octave to tcl/tk, vtk and zenity included in the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
777 octave-forge project (@url{http://octave.sourceforge.net}) for example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
778 that can be used for a GUI, but these are not @sc{Matlab}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
779 compatible. This might be an issue if you intend to exchange Octave code
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
780 with @sc{Matlab} users.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
781
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
782 @item Simulink
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
783
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
784 Octave itself includes no Simulink support. Typically the simulink
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
785 models lag research and are less flexible, so shouldn't really be used
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
786 in a research environment. However, some @sc{Matlab} users that try to use
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
787 Octave complain about this lack. There is a similar package to simulink
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
788 for the Octave and R projects available at @url{http://www.scicraft.org/}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
789
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
790 @item Mex-Files
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
791
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
792 Octave includes an API to the matlab MEX interface. However, as MEX is
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
793 an API to the internals of @sc{Matlab} and the internals of Octave differ to
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
794 @sc{Matlab}, there is necessarily a manipulation of the data to convert from
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
795 a MEX interface to the Octave equivalent. This is notable for all
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
796 complex matrices, where matlab stores complex arrays as real and
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
797 imaginary parts, whereas octave respects the C99/C++ standards of
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
798 co-locating the real/imag parts in memory. Also due to the way matlab
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
799 allows access to the arrays passed through a pointer, the MEX interface
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
800 might require that copies of arrays (even non complex ones). There were
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
801 some serious memory leaks in the MEX API in Octave up to version 2.9.9,
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
802 and version 2.9.10 or later should be used if posible.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
803
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
804 @item Block comments
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
805
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
806 @sc{Matlab} recently included the possibility to have block comments. With
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
807 the "%@{" and "%@}" markers. Octave doesn't yet have block comments, but
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
808 might in the future.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
809
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
810 @item Mat-File format
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
811
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
812 There are some differences in the mat v5 file format accepted by
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
813 Octave. @sc{Matlab} recently introduced the "-V7.3" save option which is
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
814 an hdf5 format which is particularly useful for 64-bit platforms where
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
815 the standard matlab format can not correctly save variables.. Octave
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
816 accepts hdf5 files, but is not yet compatible with the "-v7.3" versions
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
817 produced by @sc{Matlab}.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
818
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
819 Up to version 2.9.10, Octave can't load/save the inline or function
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
820 handles saved in mat-files by @sc{Matlab} (though can in its own
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
821 format). There is some work to fix this, but the @sc{Matlab} function handle
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
822 format in mat-files is undocumented and this is therefore not easy to
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
823 address.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
824
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
825 Finally, Some multi-byte unicode characters aren't yet treated in
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
826 mat-files.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
827
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
828 @item Profiler
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
829
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
830 Octave doesn't have a profiler. Though there is a patch for a flat
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
831 profiler, that might become a real profiler sometime in the future. see
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
832 the thread
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
833
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
834 @url{http://www.cae.wisc.edu/pipermail/octave-maintainers/2007-January/001685.html}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
835
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
836 for more details
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
837
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
838 @item Toolboxes
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
839
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
840 Octave is a community project and so the toolboxes that exist are
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
841 donated by those interested in them through the octave-forge website
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
842 (@url{http://octave.sourceforge.net}). These might be lacking in certain
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
843 functionality relative to the @sc{Matlab} toolboxes, and might not
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
844 exactly duplicate the matlab functionality or interface.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
845
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
846 @item Short-circuit & and | operators
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
847
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
848 The & and | operators in @sc{Matlab} short-circuit when included in an if
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
849 statemant and not otherwise. Whereas in Octave only the && and ||
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
850 short circuit. This is due to the absence of && and || in @sc{Matlab}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
851 till recently. Note that this means that
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
852
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
853 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
854 @group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
855 if (a | b)
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
856 @dots{}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
857 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
858 @end group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
859 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
860
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
861 and
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
862
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
863 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
864 @group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
865 t = a | b;
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
866 if t
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
867 @dots{}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
868 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
869 @end group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
870 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
871
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
872 are different in @sc{Matlab}. This is really a @sc{Matlab} bug, but
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
873 there is too much code out there that relies on this behavior to change
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
874 it. Prefer the || and && operators in if statements if possible.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
875
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
876 Note that the difference is also significant when either argument is a
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
877 function with side effects or if the first argument is a scalar and the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
878 second argument is an empty matrix. For example, note the difference
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
879 between
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
880
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
881 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
882 @group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
883 t = 1 | []; ## results in [], so...
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
884 if (t) 1, end ## in if ([]), this is false.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
885 @end group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
886 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
887
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
888 and
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
889
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
890 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
891 if (1 | []) 1, end ## short circuits so condition is true.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
892 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
893
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
894 Another case that is documented in the @sc{Matlab} manuals is that
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
895
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
896 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
897 @group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
898 t = [1, 1] | [1, 2, 3]; ## error
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
899 if ([1, 1] | [1, 2, 3]) 1, end ## OK
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
900 @end group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
901 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
902
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
903 Also @sc{Matlab} requires the operands of && and || to be scalar values but
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
904 Octave does not (it just applies the rule that for an operand to be
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
905 considered true, every element of the object must be nonzero or
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
906 logically true).
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
907
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
908 Finally, note the inconsistence of thinking of the condition of an if
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
909 statement as being equivalent to @code{all(X(:))} when @var{X} is a
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
910 matrix. This is true for all cases EXCEPT empty matrices:
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
911
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
912 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
913 @group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
914 if ([0, 1]) == if (all ([0, 1])) ==> i.e., condition is false.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
915 if ([1, 1]) == if (all ([1, 1])) ==> i.e., condition is true.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
916 @end group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
917 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
918
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
919 However,
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
920
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
921 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
922 if ([]) != if (all ([]))
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
923 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
924
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
925 because @code{all ([]) == 1} (because, despite the name, it is really
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
926 returning true if none of the elements of the matrix are zero, and since
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
927 there are no elements, well, none of them are zero). But, somewhere
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
928 along the line, someone decided that if @code{([])} should be false.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
929 Mathworks probably thought it just looks wrong to have @code{[]} be true
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
930 in this context even if you can use logical gymnastics to convince
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
931 yourself that "all" the elements of a matrix that doesn't actually have
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
932 any elements are nonzero. Octave however duplicates this behavior for if
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
933 statements containing empty matrices.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
934
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
935 @item Octave extensions
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
936
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
937 The extensions in Octave over @sc{Matlab} syntax are
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
938 very useful, but might cause issues when sharing with @sc{Matlab} users.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
939 A list of the major extensions that should be avoided to be compatible
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
940 with @sc{Matlab} are
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
941
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
942 @itemize @bullet
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
943 @item
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
944 Comments in octave can be marked with "#". This allows POSIX
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
945 systems to have the first line as "#! octave -q" and mark the script
6653
673686daec87 [project @ 2007-05-22 15:36:09 by jwe]
jwe
parents: 6612
diff changeset
946 itself executable. @sc{Matlab} doesn't have this feature due to the
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
947 absence of comments starting with "#"
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
948
6612
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
949 @item
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
950 Code blocks like if, for, while, etc can be terminated with block
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
951 specific terminations like "endif". @sc{Matlab} doesn't have this and
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
952 all blocks must be terminated with "end"
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
953
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
954 @item
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
955 Octave has a lisp like unwind_protect block that allows blocks of
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
956 code that terminate in an error to ensure that the variables that
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
957 are touched are restored. You can do something similar with
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
958 try/catch combined with rethrow(lasterror()) in @sc{Matlab}, however
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
959 rethrow and lasterror were only just introduced in Octave and so
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
960 aren't in 2.9.9, but are in 2.9.10.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
961
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
962 Note that using try/catch combined with rethrow(lasterror()) can not
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
963 guarentee that global variables will be correctly reset, as it won't
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
964 catch user interrupts with Ctrl-C. For example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
965
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
966 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
967 @group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
968 global a
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
969 a = 1;
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
970 try
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
971 _a = a;
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
972 a = 2
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
973 while true
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
974 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
975 catch
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
976 fprintf ('caught interrupt\n');
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
977 a = _a;
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
978 rethrow (lasterror());
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
979 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
980 @end group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
981 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
982
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
983 @noindent
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
984 compared to
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
985
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
986 @example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
987 @group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
988 global a
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
989 a = 1;
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
990 unwind_protect
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
991 _a = a;
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
992 a = 2
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
993 while true
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
994 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
995 unwind_protect_cleanup
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
996 fprintf ('caught interrupt\n');
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
997 a = _a;
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
998 end
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
999 @end group
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1000 @end example
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1001
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1002 Typing Ctrl-C in the first case returns the user directly to the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1003 prompt, and the variable "a" is not reset to the save value. In the
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1004 second case the variable "a" is reset correctly. Therefore matlab
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1005 gives no save way of temporarily changing global variables.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1006
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1007 @item
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1008 Indexing can be applied to all objects in Octave and not just
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1009 variable. Therefore @code{sin(x)(1:10);} for example is perfectly valid
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1010 in Octave but not @sc{Matlab}. To do the same in @sc{Matlab} you must do
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1011 @code{y = sin(x); y = y([1:10]);}
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1012
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1013 @item
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1014 Octave has the operators "++", "--", "-=", "+=", "*=", etc. As
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1015 @sc{Matlab} doesn't, if you are sharing code these should be avoided.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1016
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1017 @item
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1018 Strings in Octave can be denoted with double or single quotes. There is
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1019 a subtle difference between the two in that escaped characters like \n,
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1020 etc are interpreted in double quoted strings but not single quoted
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1021 strings. This difference is important on Windows platforms where the "\"
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1022 character is used in path names, and so single quoted strings should be
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1023 used in paths. @sc{Matlab} doesn't have double quoted strings and so
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1024 they should be avoided if the code will be transfered to a matlab user.
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1025 @end itemize
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1026
89f3a84a0da1 [project @ 2007-05-09 21:17:45 by jwe]
jwe
parents: 6606
diff changeset
1027 @end itemize
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
1028
4830
a3dd9369a1d4 [project @ 2004-03-10 06:10:19 by jwe]
jwe
parents: 4476
diff changeset
1029 @node Index
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
1030 @appendix Concept Index
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
1031
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
1032 @printindex cp
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
1033
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
1034 @page
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
1035 @contents
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
1036 @bye