annotate doc/faq/Octave-FAQ.texi @ 3030:353071b4970b

[project @ 1997-06-05 07:31:36 by jwe]
author jwe
date Thu, 05 Jun 1997 07:31:36 +0000
parents ef2e333f469c
children 352a80c32765
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
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
11 @subtitle December 14, 1996
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
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
93 The long-awaited version 2.0 of Octave has now been released. Many
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
94 bugs have been fixed and lots of new features added. Octave is now much
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
95 more compatible with @sc{Matlab}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
96
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
97 Version 2.0 fixes many bugs, but as with any ``x.y.0'' release there
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
98 will be a few glitches. There will probably be a 2.0.1 release to fix
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
99 most of these problems. You can help contribute to the quality of
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
100 Octave by using it and submitting bug reports for the problems you
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
101 encounter.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
102
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
103 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
104 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
105 Octave.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
106
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
107 @node Octave Features, Documentation, Version 2.0, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
108 @chapter What features are unique to Octave?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
109
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
110 @menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
111 * Command and variable name completion::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
112 * Command history::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
113 * Data structures::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
114 * Short-circuit boolean operators::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
115 * Increment and decrement operators::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
116 * Unwind-protect::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
117 * Variable-length argument lists::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
118 * Variable-length return lists::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
119 * Built-in ODE and DAE solvers::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
120 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
121
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
122 @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
123 @section Command and variable 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 @cindex Command completion
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
126 @cindex Function name completion
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
127 @cindex Variable name completion
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
128 @cindex Name completion
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 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
131 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
132 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
133 complete.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
134
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
135 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
136 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
137 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
138 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
139 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
140 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
141 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
142 (usually adding more characters until completion is possible) or type
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
143 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
144
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
145 @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
146 @section Command history
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
147
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
148 @cindex Command history
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
149 @cindex History
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 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
152 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
153 editing modes are available with Emacs keybindings enabled by default.
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 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
156 @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
157 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
158 it is easy to begin working where you left off.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
159
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
160 @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
161 @section Data structures
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
162
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
163 @cindex Data structures
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
164 @cindex Structures
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 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
167 structures. The current implementation uses an associative array
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
168 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
169 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
170
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
171 @itemize @bullet
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
172 @item Elements of structures can be of any value type.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
173
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
174 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
175 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
176 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
177 octave:2> x.a
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
178 x.a = 1
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
179 octave:3> x.b
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
180 x.b =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
181
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
182 1 2
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
183 3 4
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 octave:4> x.c
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
186 x.c = string
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
187 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
188 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
189
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
190 @item Structures may be copied.
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 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
193 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
194 octave:1> y = x
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
195 y =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
196 @{
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
197 a = 1
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
198 b =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
199
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
200 1 2
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
201 3 4
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
202
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
203 c = string
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
204 s =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
205
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
206 0.00000 0.00000 0.00000
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
207 0.00000 5.46499 0.00000
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
208 0.00000 0.00000 0.36597
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 u =
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.40455 -0.91451
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
213 -0.91451 0.40455
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 v =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
216
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
217 -0.57605 0.81742
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
218 -0.81742 -0.57605
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 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
221 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
222
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
223 @item Structure elements may reference other structures.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
224
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
225 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
226 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
227 octave:1> x.b.d = 3
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
228 x.b.d = 3
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
229 octave:2> x.b
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
230 ans =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
231 @{
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
232 d = 3
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 octave:3> x.b.d
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
235 ans = 3
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
236 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
237 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
238
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
239 @item Functions can return structures.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
240
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
241 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
242 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
243 octave:1> function y = f (x)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
244 > y.re = real (x);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
245 > y.im = imag (x);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
246 > endfunction
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
247
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
248 octave:2> f (rand + rand*I);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
249 ans =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
250 @{
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
251 im = 0.18033
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
252 re = 0.19069
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
253 @}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
254 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
255 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
256
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
257 @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
258 be indexed like any other variable.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
259
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
260 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
261 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
262 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
263 octave:2> x
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
264 x =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
265 @{
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
266 s =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
267
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
268 0.00000 0.00000 0.00000
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
269 0.00000 5.46499 0.00000
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
270 0.00000 0.00000 0.36597
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 u =
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.40455 -0.91451
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
275 -0.91451 0.40455
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 v =
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
278
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
279 -0.57605 0.81742
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
280 -0.81742 -0.57605
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
281 @}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
282 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
283 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
284
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
285 @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
286 whether a given value is a data structure. For example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
287
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
288 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
289 is_struct (x)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
290 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
291
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
292 @noindent
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
293 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
294 @end itemize
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
295
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
296 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
297 to work. Suggestions for ways to improve it are welcome.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
298
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
299 @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
300 @section Short-circuit boolean operators
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 @cindex Boolean operators, short-circuit
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
303 @cindex Logical operators, short-circuit
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
304 @cindex Short-circuit boolean operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
305 @cindex Operators, boolean
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 Octave's @samp{&&} and @samp{||} logical operators are evaluated in
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
308 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
309 language) and work differently than the element by element operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
310 @samp{&} and @samp{|}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
311
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
312 @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
313 @section Increment and decrement operators
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 @cindex Increment operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
316 @cindex Decrement operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
317 @cindex Operators, increment
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
318 @cindex Operators, decrement
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 Octave includes the C-like increment and decrement operators @samp{++}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
321 and @samp{--} in both their prefix and postfix forms.
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 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
324 @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
325 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
326 same as the expression @code{@var{x} = @var{x} + 1}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
327
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
328 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
329 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
330 @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
331 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
332 value of @var{x} is 3.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
333
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
334 For matrix and vector arguments, the increment and decrement operators
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
335 work on each element of the operand.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
336
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
337 It is not currently possible to increment index expressions. For
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
338 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
339 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
340 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
341 release of Octave.
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 @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
344 @section Unwind-protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
345
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
346 @cindex Unwind-protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
347
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
348 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
349 unwind-protect form of Lisp. The general form of an
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
350 @code{unwind_protect} block looks like this:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
351
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
352 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
353 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
354 unwind_protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
355 @var{body}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
356 unwind_protect_cleanup
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
357 @var{cleanup}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
358 end_unwind_protect
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
359 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
360 @end example
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 @noindent
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
363 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
364 Octave expressions or commands. The statements in @var{cleanup} are
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
365 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
366
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
367 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
368 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
369
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
370 @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
371 @section Variable-length argument lists
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
372
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
373 @cindex Variable-length argument lists
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
374 @cindex Argument lists, variable-length
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 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
377 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
378 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
379 accept.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
380
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
381 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
382 header followed by an unspecified number of values:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
383
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
384 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
385 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
386 function foo (heading, ...)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
387 disp (heading);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
388 va_start ();
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
389 while (--nargin)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
390 disp (va_arg ());
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
391 endwhile
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
392 endfunction
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
393 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
394 @end example
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 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
397 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
398 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
399 to cycle through the arguments more than once.
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 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
402 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
403 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
404 available.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
405
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
406 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
407 unnamed arguments to another function.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
408
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
409 @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
410 @section Variable-length return lists
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
411
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
412 @cindex Variable-length return lists
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
413 @cindex Return lists, variable-length
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
414
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
415 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
416 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
417 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
418
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
419 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
420 @samp{N} values:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
421
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
422 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
423 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
424 function [...] = foo (n)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
425 for i = 1:n
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
426 vr_val (i);
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
427 endfor
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
428 endfunction
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
429 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
430 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
431
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
432 @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
433 @section Built-in ODE and DAE solvers
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
434
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
435 @cindex DASSL
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
436 @cindex LSODE
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
437
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
438 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
439 differential and differential-algebraic equations. These functions are
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
440 built in to the interpreter.
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 @node Documentation, Getting Octave, Octave Features, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
443 @chapter What documentation exists for Octave?
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 @cindex Octave, documentation
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
446
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
447 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
448 distributed under the terms of the GNU GPL.
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 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
451 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
452 that some topic is not adequately explained, indexed, or
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
453 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
454
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
455 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
456 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
457 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
458 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
459
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
460 It is also possible to use your favorite WWW browser to read the Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
461 manual (or any other Info file) by using Roar Smith's info2www program
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
462 to convert GNU Info files to HTML. The source for info2www is available
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
463 from @url{ftp://ftp.che.wisc.edu/pub/www}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
464
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
465 @node Getting Octave, Installation, Documentation, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
466 @chapter Obtaining Source Code
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
467
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
468 @cindex Source code
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 @menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
471 * Octave for Unix::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
472 * Octave for other platforms::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
473 * latest versions::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
474 @end menu
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 @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
477 @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
478
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
479 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
480 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
481
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
482 @cindex Octave, ordering
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
483 @cindex Octave, getting a copy
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
484
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
485 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
486 and the developers of Octave support the efforts of the FSF by
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
487 encouraging users of Octave to order Octave on tape or CD directly from
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
488 the FSF.
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 The FSF is a nonprofit organization that distributes software and
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
491 manuals to raise funds for more GNU development. Buying a tape or CD
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
492 from the FSF contributes directly to paying staff to develop GNU
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
493 software. CD-ROMs cost $400 if an organization is buying, or $100 if an
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
494 individual is buying. Tapes cost around $200 depending on media type.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
495
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
496 The FSF only makes new CD releases a few times a year, so if you are
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
497 interested specifically in Octave, I recommend asking for the latest
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
498 release on tape.
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 @cindex FSF [Free Software Foundation]
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
501 @cindex GNU [GNU's not unix]
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
502
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
503 For more information about ordering from the FSF, contact
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
504 gnu@@prep.ai.mit.edu, phone (617) 542-5942 or anonymous ftp file
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
505 @file{/pub/gnu/GNUinfo/ORDERS} from prep.ai.mit.edu or one of the sites
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
506 listed below.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
507
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
508 @cindex FSF, contact <gnu@@prep.ai.mit.edu>
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
509 @cindex GNUware, anonymous FTP sites
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
510
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 @file{INSTALL}.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
519
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
520 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
521 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
522 contact bug-octave@@bevo.che.wisc.edu.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
523
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
524 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
525 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
526 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
527 last release.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
528
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
529 @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
530 @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
531
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
532 @cindex VMS support
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
533 @cindex VAX
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
534 @cindex MS-DOS support
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
535 @cindex DJGPP
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
536 @cindex EMX
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
537 @cindex OS/2 support
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
538
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
539 Octave currently runs on Unix-like systems only. It should be possible
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
540 to make Octave work on other systems. If you are interested in porting
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
541 Octave to other systems, please contact bug-octave@@bevo.che.wisc.edu.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
542
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
543 @node latest versions, , Octave for other platforms, Getting Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
544 @section What is the latest version of Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
545
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
546 @cindex Octave, version date
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
547
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
548 The latest version of Octave is 2.0, released December 1996.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
549
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
550 @node Installation, Common problems, Getting Octave, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
551 @chapter Installation Issues and Problems
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 @cindex Octave, building
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
554
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
555 Octave requires approximately 50MB of disk storage to unpack and
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
556 install (significantly less if you don't compile with debugging
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
557 symbols).
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 Octave has been compiled and tested with g++ and libg++ on a
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
560 SPARCstation 2 running SunOS 4.1.2, an IBM RS/6000 running AIX 3.2.5,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
561 DEC Alpha systems running OSF/1 1.3 and 3.0, a DECstation 5000/240
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
562 running Ultrix 4.2a, and i486 systems running Linux. It should work on
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
563 most other Unix systems that have a working port of g++ and libg++.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
564
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
565 @menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
566 * What else do I need?::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
567 * Other C++ compilers?::
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
568 @end menu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
569
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
570 @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
571 @section What else do I need?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
572
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
573 @cindex GNU gcc
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
574 @cindex GNU g++
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
575 @cindex libg++
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
576 @cindex GNU Make
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
577 @cindex Flex
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
578 @cindex GNU Bison
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
579
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
580 In order to build Octave, you will need a current version
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
581 of g++, libg++, and GNU make. If you don't have these tools, you can
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
582 get them from many anonymous ftp archives, including ftp.che.wisc.edu,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
583 ftp.uu.net, prep.ai.mit.edu, and wuarchive.wustl.edu, or by writing to
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
584 the FSF at 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
585
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
586 @node Other C++ compilers?, , What else do I need?, Installation
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
587 @section Can I compile Octave with another C++ compiler?
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
588
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
589 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
590 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
591 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
592 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
593 compilers, please contact bug-octave@@bevo.che.wisc.edu.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
594
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
595 @node Common problems, Getting additional help, Installation, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
596 @chapter Common problems
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
597
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
598 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
599 questions (preferably with answers!)
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
600
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
601 @itemize @bullet
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
602 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
603 Octave takes a long time to find symbols.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
604
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
605 Octave is probably spending this time recursively searching directories
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
606 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
607 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
608 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
609 directories? In order for the recursive directory searching code to
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
610 work efficiently, directories that are to be searched recursively should
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
611 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
612 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
613 function files is installed this way.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
614 @end itemize
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
615
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
616 @node Getting additional help, Bug reports, Common problems, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
617 @chapter Getting additional help
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
618
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
619 @cindex Additional help
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
620 @cindex Mailing lists, help-octave
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 The mailing list
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
623
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
624 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
625 help-octave@@bevo.che.wisc.edu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
626 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
627
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
628 @noindent
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
629 is available for questions related to using, installing, and porting
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
630 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
631 document.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
632
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
633 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
634 to the list, please send a short note to
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
635
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
636 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
637 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
638 help-octave-request@@bevo.che.wisc.edu
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
639 ^^^^^^^
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
640 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
641 @end example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
642
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
643 @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
644 mailing list, or other administrative trivia to the list itself.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
645
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
646 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
647 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
648
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
649 @node Bug reports, MATLAB compatibility, Getting additional help, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
650 @chapter I think I have found a bug in Octave.
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 @cindex Bug in Octave, newly found
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
653
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
654 ``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
655 and who should I tell?''
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 @cindex Manual, for Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
658
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
659 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
660 The Octave manual is included in the Octave distribution.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
661
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
662 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
663 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
664 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
665 the Octave maintainers can duplicate your bug.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
666
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
667 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
668 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
669 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
670 file that already contains all the configuration information. When you
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
671 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
672
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
673 @cindex Octave bug report
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
674 @cindex Mailing lists, bug-octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
675
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
676 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
677 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
678 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
679 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
680 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
681 report.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
682
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
683 @node MATLAB compatibility, Index, Bug reports, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
684 @chapter Porting programs from @sc{Matlab} to Octave
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
685
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
686 @cindex @sc{Matlab} compatibility
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
687 @cindex Compatibility with @sc{Matlab}
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
688
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
689 ``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
690 Octave. Is there anything I should watch out for?''
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
691
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
692 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
693 three categories:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
694
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
695 @enumerate
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
696 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
697 Irrelevant.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
698
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
699 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
700 Known differences, perhaps configurable with a user preference variable.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
701
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
702 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
703 Unknown differences.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
704 @end enumerate
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
705
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
706 The first category, irrelevant differences, do not affect computations
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
707 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
708
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
709 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
710 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
711 @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
712 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
713 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
714 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
715 command line option @samp{--traditional}, which implies all of these
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
716 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
717 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
718
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
719 @example
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
720 @group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
721 PS1 = ">> ";
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
722 PS2 = "";
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
723 beep_on_error = 1;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
724 default_save_format = "mat-binary";
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
725 define_all_return_values = 1;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
726 do_fortran_indexing = 1;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
727 empty_list_elements_ok = 1;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
728 implicit_str_to_num_ok = 1;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
729 ok_to_lose_imaginary_part = 1;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
730 page_screen_output = 0;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
731 prefer_column_vectors = 0;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
732 prefer_zero_one_indexing = 1;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
733 print_empty_dimensions = 0;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
734 treat_neg_dim_as_zero = 1;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
735 warn_function_name_clash = 0;
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
736 whitespace_in_literal_matrix = "traditional";
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
737 @end group
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
738 @end example
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 Some other known differences are:
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
741
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
742 @itemize @bullet
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
743 @item
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
744 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
745 @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
746 @end itemize
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
747
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
748 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
749 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
750 description of this difference (with code illustrating the difference,
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
751 if possible) to bug-octave@@bevo.che.wisc.edu.
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
752
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
753 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
754 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
755
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
756 @node Index, , MATLAB compatibility, Top
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
757 @appendix Concept Index
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 @printindex cp
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
760
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
761 @page
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
762 @contents
ef2e333f469c [project @ 1997-04-18 07:39:43 by jwe]
jwe
parents:
diff changeset
763 @bye