annotate doc/faq/Octave-FAQ.texi @ 4452:f3c21a1d1c62

[project @ 2003-07-09 23:20:18 by jwe]
author jwe
date Wed, 09 Jul 2003 23:20:19 +0000
parents ea1d3e1a4b1b
children abbf63293766
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
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
7
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
8 @titlepage
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
9 @title Octave FAQ
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
10 @subtitle Frequently asked questions about Octave
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
11 @subtitle February 14, 1998
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
12 @sp 1
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
13 @author John W. Eaton
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
14 @page
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
15 @end titlepage
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
16
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
17 @ifinfo
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
18 @node Top, What is Octave?, (dir), (dir)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
19 @top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
20 @unnumbered Preface
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
21 @cindex FAQ for Octave, latest version
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
22 @end ifinfo
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
23
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
24 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
25
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
26 Some information in this FAQ was written for earlier versions of
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
27 Octave and may now be obsolete.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
28
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
29 I'm looking for new questions (@emph{with} answers), better answers,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
30 or both. Please send suggestions to bug-octave@@bevo.che.wisc.edu.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
31 If you have general questions about Octave, or need help for something
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
32 that is not covered by the Octave manual or the FAQ, please use the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
33 help-octave@@bevo.che.wisc.edu mailing list.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
34
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
35 This FAQ is intended to supplement, not replace, the Octave manual.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
36 Before posting a question to the help-octave mailing list, you should
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
37 first check to see if the topic is covered in the manual.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
38
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
39 @menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
40 * What is Octave?::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
41 * Version 2.0::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
42 * Octave Features::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
43 * Documentation::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
44 * Getting Octave::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
45 * Installation::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
46 * Common problems::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
47 * Getting additional help::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
48 * Bug reports::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
49 * MATLAB compatibility::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
50 * Index::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
51 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
52
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
53 @node What is Octave?, Version 2.0, Top, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
54 @chapter What is Octave?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
55
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
56 Octave is a high-level interactive language, primarily intended for
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
57 numerical computations that is mostly compatible with
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
58 @sc{Matlab}.@footnote{@sc{Matlab} is a registered trademark of The MathWorks,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
59 Inc.}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
60
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
61 Octave can do arithmetic for real and complex scalars and matrices,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
62 solve sets of nonlinear algebraic equations, integrate functions over
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
63 finite and infinite intervals, and integrate systems of ordinary
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
64 differential and differential-algebraic equations.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
65
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
66 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
67 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
68 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
69 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
70 command history is saved, so that commands entered during previous
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
71 sessions are not lost.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
72
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
73 The Octave distribution includes a 200+ page Texinfo manual. Access
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
74 to the complete text of the manual is available via the help command
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
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
77 Two and three dimensional plotting is fully supported using gnuplot.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
78
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
79 The underlying numerical solvers are currently standard Fortran ones
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
80 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
81 of C++ classes. If possible, the Fortran subroutines are compiled
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
82 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
83 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
84 you have the free Fortran to C translator f2c.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
85
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
86 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
87 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
88 Free Software Foundation.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
89
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
90 @node Version 2.0, Octave Features, What is Octave?, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
91 @chapter What's new in version 2.0 of Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
92
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
93 Version 2.0.10 of Octave was released February 6, 1998. Most bugs
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
94 reported since version 2.0 was release have been fixed, and a number of
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
95 new features have been added. Octave is now much more compatible with
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
96 @sc{Matlab}.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
97
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
98 A list of user-visible changes in recent versions of Octave may be found
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
99 in the file NEWS, distributed in both source and binary releases of
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
100 Octave.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
101
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
102 @node Octave Features, Documentation, Version 2.0, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
103 @chapter What features are unique to Octave?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
104
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
105 @menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
106 * Command and variable name completion::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
107 * Command history::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
108 * Data structures::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
109 * Short-circuit boolean operators::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
110 * Increment and decrement operators::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
111 * Unwind-protect::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
112 * Variable-length argument lists::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
113 * Variable-length return lists::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
114 * Built-in ODE and DAE solvers::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
115 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
116
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
117 @node Command and variable name completion, Command history, Octave Features, Octave Features
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
118 @section Command and variable name completion
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
119
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
120 @cindex Command completion
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
121 @cindex Function name completion
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
122 @cindex Variable name completion
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
123 @cindex Name completion
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
124
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
125 Typing a TAB character (ASCII code 9) on the command line causes Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
126 to attempt to complete variable, function, and file names. Octave uses
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
127 the text before the cursor as the initial portion of the name to
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
128 complete.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
129
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
130 For example, if you type @samp{fu} followed by TAB at the Octave prompt,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
131 Octave will complete the rest of the name @samp{function} on the command
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
132 line (unless you have other variables or functions defined that begin
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
133 with the characters @samp{fu}). If there is more than one possible
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
134 completion, Octave will ring the terminal bell to let you know that your
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
135 initial sequence of characters is not enough to specify a unique name.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
136 To complete the name, you may either edit the initial character sequence
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
137 (usually adding more characters until completion is possible) or type
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
138 another TAB to cause Octave to display the list of possible completions.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
139
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
140 @node Command history, Data structures, Command and variable name completion, Octave Features
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
141 @section Command history
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
142
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
143 @cindex Command history
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
144 @cindex History
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
145
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
146 When running interactively, Octave saves the commands you type in an
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
147 internal buffer so that you can recall and edit them. Emacs and vi
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
148 editing modes are available with Emacs keybindings enabled by default.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
149
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
150 When Octave exits, the current command history is saved to the file
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
151 @file{~/.octave_hist}, and each time Octave starts, it inserts the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
152 contents of the @file{~/.octave_hist} file in the history list so that
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
153 it is easy to begin working where you left off.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
154
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
155 @node Data structures, Short-circuit boolean operators, Command history, Octave Features
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
156 @section Data structures
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
157
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
158 @cindex Data structures
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
159 @cindex Structures
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
160
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
161 Octave includes a limited amount of support for organizing data in
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
162 structures. The current implementation uses an associative array
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
163 with indices limited to strings, but the syntax is more like C-style
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
164 structures. Here are some examples of using data structures in Octave.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
165
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
166 @itemize @bullet
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
167 @item Elements of structures can be of any value type.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
168
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
169 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
170 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
171 octave:1> x.a = 1; x.b = [1, 2; 3, 4]; x.c = "string";
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
172 octave:2> x.a
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
173 x.a = 1
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
174 octave:3> x.b
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
175 x.b =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
176
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
177 1 2
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
178 3 4
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
179
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
180 octave:4> x.c
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
181 x.c = string
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
182 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
183 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
184
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
185 @item Structures may be copied.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
186
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
187 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
188 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
189 octave:1> y = x
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
190 y =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
191 @{
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
192 a = 1
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
193 b =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
194
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
195 1 2
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
196 3 4
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
197
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
198 c = string
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
199 s =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
200
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
201 0.00000 0.00000 0.00000
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
202 0.00000 5.46499 0.00000
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
203 0.00000 0.00000 0.36597
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
204
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
205 u =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
206
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
207 -0.40455 -0.91451
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
208 -0.91451 0.40455
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
209
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
210 v =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
211
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
212 -0.57605 0.81742
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
213 -0.81742 -0.57605
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
214 @}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
215 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
216 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
217
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
218 @item Structure elements may reference other structures.
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 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
221 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
222 octave:1> x.b.d = 3
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
223 x.b.d = 3
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
224 octave:2> x.b
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
225 ans =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
226 @{
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
227 d = 3
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
228 @}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
229 octave:3> x.b.d
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
230 ans = 3
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
231 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
232 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
233
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
234 @item Functions can return structures.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
235
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
236 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
237 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
238 octave:1> function y = f (x)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
239 > y.re = real (x);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
240 > y.im = imag (x);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
241 > endfunction
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 octave:2> f (rand + rand*I);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
244 ans =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
245 @{
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
246 im = 0.18033
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
247 re = 0.19069
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
248 @}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
249 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
250 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
251
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
252 @item Function return lists can include structure elements, and they may
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
253 be indexed like any other variable.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
254
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
255 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
256 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
257 octave:1> [x.u, x.s(2:3,2:3), x.v] = svd ([1, 2; 3, 4]);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
258 octave:2> x
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
259 x =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
260 @{
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
261 s =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
262
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
263 0.00000 0.00000 0.00000
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
264 0.00000 5.46499 0.00000
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
265 0.00000 0.00000 0.36597
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
266
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
267 u =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
268
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
269 -0.40455 -0.91451
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
270 -0.91451 0.40455
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
271
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
272 v =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
273
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
274 -0.57605 0.81742
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
275 -0.81742 -0.57605
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
276 @}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
277 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
278 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
279
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
280 @item You can also use the function @code{is_struct} to determine
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
281 whether a given value is a data structure. For example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
282
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
283 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
284 is_struct (x)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
285 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
286
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
287 @noindent
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
288 returns 1 if the value of the variable @var{x} is a data structure.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
289 @end itemize
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
290
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
291 This feature should be considered experimental, but you should expect it
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
292 to work. Suggestions for ways to improve it are welcome.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
293
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
294 @node Short-circuit boolean operators, Increment and decrement operators, Data structures, Octave Features
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
295 @section Short-circuit boolean operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
296
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
297 @cindex Boolean operators, short-circuit
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
298 @cindex Logical operators, short-circuit
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
299 @cindex Short-circuit boolean operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
300 @cindex Operators, boolean
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
301
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
302 Octave's @samp{&&} and @samp{||} logical operators are evaluated in
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
303 a short-circuit fashion (like the corresponding operators in the C
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
304 language) and work differently than the element by element operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
305 @samp{&} and @samp{|}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
306
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
307 @node Increment and decrement operators, Unwind-protect, Short-circuit boolean operators, Octave Features
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
308 @section Increment and decrement operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
309
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
310 @cindex Increment operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
311 @cindex Decrement operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
312 @cindex Operators, increment
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
313 @cindex Operators, decrement
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
314
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
315 Octave includes the C-like increment and decrement operators @samp{++}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
316 and @samp{--} in both their prefix and postfix forms.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
317
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
318 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
319 @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
320 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
321 same as the expression @code{@var{x} = @var{x} + 1}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
322
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
323 To post-increment a variable @var{x}, you would write @code{@var{x}++}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
324 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
325 @var{x} had prior to incrementing it. For example, if @var{x} is equal
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
326 to 2, the result of the expression @code{@var{x}++} is 2, and the new
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
327 value of @var{x} is 3.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
328
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
329 For matrix and vector arguments, the increment and decrement operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
330 work on each element of the operand.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
331
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
332 It is not currently possible to increment index expressions. For
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
333 example, you might expect that the expression @code{@var{v}(4)++} would
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
334 increment the fourth element of the vector @var{v}, but instead it
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
335 results in a parse error. This problem may be fixed in a future
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
336 release of Octave.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
337
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
338 @node Unwind-protect, Variable-length argument lists, Increment and decrement operators, Octave Features
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
339 @section Unwind-protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
340
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
341 @cindex Unwind-protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
342
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
343 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
344 unwind-protect form of Lisp. The general form of an
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
345 @code{unwind_protect} block looks like this:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
346
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
347 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
348 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
349 unwind_protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
350 @var{body}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
351 unwind_protect_cleanup
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
352 @var{cleanup}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
353 end_unwind_protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
354 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
355 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
356
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
357 @noindent
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
358 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
359 Octave expressions or commands. The statements in @var{cleanup} are
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
360 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
361
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
362 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
363 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
364
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
365 @node Variable-length argument lists, Variable-length return lists, Unwind-protect, Octave Features
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
366 @section Variable-length argument lists
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
367
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
368 @cindex Variable-length argument lists
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
369 @cindex Argument lists, variable-length
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
370
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
371 Octave has a real mechanism for handling functions that take an
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
372 unspecified number of arguments, so it is no longer necessary to place
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
373 an upper bound on the number of optional arguments that a function can
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
374 accept.
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 Here is an example of a function that uses the new syntax to print a
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
377 header followed by an unspecified number of values:
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 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
380 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
381 function foo (heading, ...)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
382 disp (heading);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
383 va_start ();
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
384 while (--nargin)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
385 disp (va_arg ());
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
386 endwhile
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
387 endfunction
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
388 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
389 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
390
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
391 Calling @code{va_start()} positions an internal pointer to the first
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
392 unnamed argument and allows you to cycle through the arguments more than
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
393 once. It is not necessary to call @code{va_start()} if you do not plan
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
394 to cycle through the arguments more than once.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
395
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
396 The function @code{va_arg()} returns the value of the next available
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
397 argument and moves the internal pointer to the next argument. It is an
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
398 error to call @code{va_arg()} when there are no more arguments
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
399 available.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
400
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
401 It is also possible to use the keyword @var{all_va_args} to pass all
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
402 unnamed arguments to another function.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
403
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
404 @node Variable-length return lists, Built-in ODE and DAE solvers, Variable-length argument lists, Octave Features
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
405 @section Variable-length return lists
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
406
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
407 @cindex Variable-length return lists
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
408 @cindex Return lists, variable-length
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
409
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
410 Octave also has a real mechanism for handling functions that return an
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
411 unspecified number of values, so it is no longer necessary to place an
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
412 upper bound on the number of outputs that a function can produce.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
413
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
414 Here is an example of a function that uses the new syntax to produce
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
415 @samp{N} values:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
416
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
417 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
418 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
419 function [...] = foo (n)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
420 for i = 1:n
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
421 vr_val (i);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
422 endfor
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
423 endfunction
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
424 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
425 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
426
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
427 @node Built-in ODE and DAE solvers, , Variable-length return lists, Octave Features
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
428 @section Built-in ODE and DAE solvers
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
429
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
430 @cindex DASSL
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
431 @cindex LSODE
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
432
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
433 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
434 differential and differential-algebraic equations. These functions are
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
435 built in to the interpreter.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
436
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
437 @node Documentation, Getting Octave, Octave Features, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
438 @chapter What documentation exists for Octave?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
439
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
440 @cindex Octave, documentation
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
441
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
442 The Octave distribution includes a 220+ page manual that is also
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
443 distributed under the terms of the GNU GPL.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
444
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
445 The Octave manual is intended to be a complete reference for Octave, but
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
446 it is not a finished document. If you have problems using it, or find
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
447 that some topic is not adequately explained, indexed, or
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
448 cross-referenced, please send a bug report to bug-octave@@bevo.che.wisc.edu.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
449
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
450 Because the Octave manual is written using Texinfo, the complete text of
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
451 the Octave manual is also available on line using the GNU Info system
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
452 via the GNU Emacs, info, or xinfo programs, or by using the @samp{help -i}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
453 command to start the GNU info browser directly from the Octave prompt.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
454
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
455 It is also possible to use your favorite WWW browser to read the Octave
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
456 manual by converting the Texinfo source to HTML using the
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
457 @code{texi2html} program.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
458
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
459 @node Getting Octave, Installation, Documentation, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
460 @chapter Obtaining Source Code
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
461
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
462 @cindex Source code
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
463
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
464 @menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
465 * Octave for Unix::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
466 * Octave for other platforms::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
467 * latest versions::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
468 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
469
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
470 @node Octave for Unix, Octave for other platforms, Getting Octave, Getting Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
471 @section How do I get a copy of Octave for Unix?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
472
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
473 You can get Octave from a friend who has a copy, by anonymous FTP, or by
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
474 ordering a tape or CD-ROM from the Free Software Foundation (FSF).
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
475
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
476 @cindex Octave, ordering
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
477 @cindex Octave, getting a copy
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
478
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
479 Octave was not developed by the FSF, but the FSF does distribute Octave,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
480 and the developers of Octave support the efforts of the FSF by
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
481 encouraging users of Octave to order Octave on CD-ROM directly from
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
482 the FSF.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
483
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
484 The FSF is a nonprofit organization that distributes software and
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
485 manuals to raise funds for more GNU development. Buying a CD-ROM from
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
486 the FSF contributes directly to paying staff to develop GNU software.
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
487 CD-ROMs cost $240 if an organization is buying, or $60 if an individual
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
488 is buying.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
489
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
490 @cindex FSF [Free Software Foundation]
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
491 @cindex GNU [GNU's not unix]
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
492
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
493 For more information about ordering from the FSF, contact
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
494 gnu@@gnu.org, phone (617) 542-5942 or anonymous ftp the file
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
495 @file{/pub/gnu/GNUinfo/ORDERS} from ftp.gnu.org.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
496
3285
6929a31e7624 [project @ 1999-10-13 21:59:11 by jwe]
jwe
parents: 3154
diff changeset
497 @cindex FSF, contact <gnu@@gnu.org>
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
498 @cindex GNUware, anonymous FTP sites
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
499
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
500 If you are on the Internet, you can copy the latest distribution
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
501 version of Octave from the file @file{/pub/octave/octave-M.N.tar.gz}, on
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
502 the host @file{ftp.che.wisc.edu}. This tar file has been compressed
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
503 with GNU gzip, so be sure to use binary mode for the transfer. @samp{M}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
504 and @samp{N} stand for version numbers; look at a listing of the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
505 directory through ftp to see what version is available. After you
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
506 unpack the distribution, be sure to look at the files @file{README} and
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
507 @file{INSTALL}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
508
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
509 Binaries for several popular systems are also available. If you would
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
510 like help out by making binaries available for other systems, please
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
511 contact bug-octave@@bevo.che.wisc.edu.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
512
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
513 A list of user-visible changes since the last release is available in
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
514 the file @file{NEWS}. The file @file{ChangeLog} in the source
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
515 distribution contains a more detailed record of changes made since the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
516 last release.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
517
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
518 @node Octave for other platforms, latest versions, Octave for Unix, Getting Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
519 @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
520
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
521 @cindex VMS support
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
522 @cindex VAX
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
523 @cindex MS-DOS support
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
524 @cindex Windows support
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
525 @cindex DJGPP
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
526 @cindex EMX
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
527 @cindex OS/2 support
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
528
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
529 Octave currently runs on Unix-like systems, OS/2, and Windows NT/95
3840
79474340b3a1 [project @ 2001-06-17 02:17:33 by jwe]
jwe
parents: 3285
diff changeset
530 (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
531 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
532 porting Octave to other systems, please contact
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
533 bug-octave@@bevo.che.wisc.edu.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
534
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
535 @node latest versions, , Octave for other platforms, Getting Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
536 @section What is the latest version of Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
537
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
538 @cindex Octave, version date
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
539
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
540 The latest version of Octave is 2.0.10, released February 6, 1998.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
541
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
542 @node Installation, Common problems, Getting Octave, Top
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
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
547 Octave requires approximately 125MB of disk storage to unpack and
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
548 compile from source (significantly less if you don't compile with
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
549 debugging symbols or create shared libraries). Once installed, Octave
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
550 requires approximately 65MB of disk space (again, considerably less if
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
551 you don't build shared libraries or the binaries and libraries do not
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
552 include debugging symbols).
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
553
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
554 @menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
555 * What else do I need?::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
556 * Other C++ compilers?::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
557 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
558
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
559 @node What else do I need?, Other C++ compilers?, Installation, Installation
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
560 @section What else do I need?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
561
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
562 @cindex GNU gcc
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
563 @cindex GNU g++
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
564 @cindex libg++
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
565 @cindex GNU Make
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
566 @cindex Flex
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
567 @cindex GNU Bison
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
568
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
569 To compile Octave, you will need a recent version of GNU Make. You
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
570 will also need g++ 2.7.2 or later. Version 2.8.0 or egcs 1.0.x should
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
571 work. Later versions may work, but C++ is still evolving, so don't be
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
572 too surprised if you run into some trouble.
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
573
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
574 It is no longer necessary to have libg++, but you do need to have the
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
575 GNU implementation of libstdc++. If you are using g++ 2.7.2,
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
576 libstdc++ is distributed along with libg++, but for later versions,
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
577 libstdc++ is distributed separately. For egcs, libstdc++ is included
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
578 with the compiler distribution.
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
579
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
580 <em>You must have gnu make to compile octave</em>. Octave's Makefiles
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
581 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
582 GNU Make is very portable and easy to install.
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
583
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
584 @node Other C++ compilers?, , What else do I need?, Installation
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
585 @section Can I compile Octave with another C++ compiler?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
586
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
587 Currently, Octave can only be compiled with the GNU C++ compiler. It
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
588 would be nice to make it possible to compile Octave with other C++
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
589 compilers, but the maintainers do not have sufficient time to devote to
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
590 this. If you are interested in working to make Octave portable to other
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
591 compilers, please contact bug-octave@@bevo.che.wisc.edu.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
592
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
593 @node Common problems, Getting additional help, Installation, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
594 @chapter Common problems
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
595
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
596 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
597 questions (preferably with answers!)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
598
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
599 @itemize @bullet
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
600 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
601 Octave takes a long time to find symbols.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
602
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
603 Octave is probably spending this time recursively searching directories
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
604 for function files. Check the value of your LOADPATH. For those
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
605 elements that end in @samp{//}, do any name a very large directory tree?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
606 Does it contain directories that have a mixture of files and
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
607 directories? In order for the recursive directory searching code to
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
608 work efficiently, directories that are to be searched recursively should
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
609 have either function files only, or subdirectories only, but not a
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
610 mixture of both. Check to make sure that Octave's standard set of
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
611 function files is installed this way.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
612 @end itemize
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 @node Getting additional help, Bug reports, Common problems, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
615 @chapter Getting additional help
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
616
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
617 @cindex Additional help
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
618 @cindex Mailing lists, help-octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
619
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
620 The mailing list
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
621
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
622 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
623 help-octave@@bevo.che.wisc.edu
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
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
626 @noindent
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
627 is available for questions related to using, installing, and porting
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
628 Octave that are not adequately answered by the Octave manual or by this
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
629 document.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
630
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
631 If you would like to join the discussion and receive all messages sent
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
632 to the list, please send a short note to
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
633
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
634 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
635 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
636 help-octave-request@@bevo.che.wisc.edu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
637 ^^^^^^^
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
638 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
639 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
640
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
641 @strong{Please do not} send requests to be added or removed from the the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
642 mailing list, or other administrative trivia to the list itself.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
643
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
644 An archive of old postings to the help-octave mailing list is maintained
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
645 on ftp.che.wisc.edu in the directory @file{/pub/octave/MAILING-LISTS}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
646
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
647 @node Bug reports, MATLAB compatibility, Getting additional help, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
648 @chapter I think I have found a bug in Octave.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
649
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
650 @cindex Bug in Octave, newly found
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
651
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
652 ``I think I have found a bug in Octave, but I'm not sure. How do I know,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
653 and who should I tell?''
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
654
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
655 @cindex Manual, for Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
656
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
657 First, see the section on bugs and bug reports in the Octave manual.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
658 The Octave manual is included in the Octave distribution.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
659
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
660 When you report a bug, make sure to describe the type of computer you
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
661 are using, the version of the operating system it is running, and the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
662 version of Octave that you are using. Also provide enough code so that
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
663 the Octave maintainers can duplicate your bug.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
664
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
665 If you have Octave working at all, the easiest way to do this is to use
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
666 the Octave function @code{bug_report}. When you execute this function,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
667 Octave will prompt you for a subject and then invoke the editor on a
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
668 file that already contains all the configuration information. When you
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
669 exit the editor, Octave will mail the bug report for you.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
670
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
671 @cindex Octave bug report
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
672 @cindex Mailing lists, bug-octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
673
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
674 If for some reason you cannot use Octave's @code{bug_report} function,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
675 mail your bug report to "bug-octave@@bevo.che.wisc.edu". Your message
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
676 needs to include enough information to allow the maintainers of Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
677 to fix the bug. Please read the section on bugs and bug reports in the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
678 Octave manual for a list of things that should be included in every bug
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
679 report.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
680
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
681 @node MATLAB compatibility, Index, Bug reports, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
682 @chapter Porting programs from @sc{Matlab} to Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
683
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
684 @cindex @sc{Matlab} compatibility
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
685 @cindex Compatibility with @sc{Matlab}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
686
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
687 ``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
688 Octave. Is there anything I should watch out for?''
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
689
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
690 The differences between Octave and @sc{Matlab} typically fall into one of
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
691 three categories:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
692
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
693 @enumerate
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
694 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
695 Irrelevant.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
696
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
697 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
698 Known differences, perhaps configurable with a user preference variable.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
699
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
700 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
701 Unknown differences.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
702 @end enumerate
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
703
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
704 The first category, irrelevant differences, do not affect computations
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
705 and most likely do not affect the execution of function files.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
706
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
707 The differences of the second category are usually because the authors
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
708 of Octave decided on a better (subjective) implementation that the way
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
709 @sc{Matlab} does it, and so introduced ``user preference variables'' so that
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
710 you can customize Octave's behavior to be either @sc{Matlab}-compatible or
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
711 to use Octave's new features. To make Octave more @sc{Matlab}-compatible,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
712 put the following statements in your @file{~/.octaverc} file, or use the
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
713 command line option @samp{--traditional}, which implies all of these
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
714 settings. Note that this list may not be complete, because some new
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
715 variables may have been introduced since this document was last updated.
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 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
718 @group
3154
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
719 PS1 = ">> "
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
720 PS2 = ""
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
721 beep_on_error = 1.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
722 default_eval_print_flag = 0.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
723 default_save_format = "mat-binary"
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
724 define_all_return_values = 1.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
725 do_fortran_indexing = 1.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
726 empty_list_elements_ok = 1.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
727 fixed_point_format = 1.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
728 page_screen_output = 0.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
729 prefer_column_vectors = 0.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
730 prefer_zero_one_indexing = 1.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
731 print_empty_dimensions = 0.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
732 treat_neg_dim_as_zero = 1.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
733 warn_function_name_clash = 0.0
352a80c32765 [project @ 1998-02-14 19:17:59 by jwe]
jwe
parents: 3030
diff changeset
734 whitespace_in_literal_matrix = "traditional"
2866
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
735 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
736 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
737
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
738 Some other known differences are:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
739
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
740 @itemize @bullet
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
741 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
742 The Octave plotting functions are mostly compatible with the ones from
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
743 @sc{Matlab} 3.x, but not from @sc{Matlab} 4.x.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
744 @end itemize
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
745
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
746 The third category of differences is (hopefully) shrinking. If you find
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
747 a difference between Octave behavior and @sc{Matlab}, then you should send a
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
748 description of this difference (with code illustrating the difference,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
749 if possible) to bug-octave@@bevo.che.wisc.edu.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
750
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
751 An archive of old postings to the Octave mailing lists is maintained
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
752 on ftp.che.wisc.edu in the directory @file{/pub/octave/MAILING-LISTS}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
753
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
754 @node Index, , MATLAB compatibility, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
755 @appendix Concept Index
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
756
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
757 @printindex cp
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
758
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
759 @page
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
760 @contents
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
761 @bye