annotate doc/interpreter/basics.txi @ 9153:5247e89688e1

Eliminate most overfull errors when running texi2pdf for generating pdf documentation Use @smallexample when necessary to reduce font for long lines. Reword variables or phrases so that Tex can break them at a better spot.
author Rik <rdrider0-list@yahoo.com>
date Fri, 24 Apr 2009 12:29:01 -0700
parents b04f95fabbf9
children 8d20fb66a0dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
1 @c Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8817
diff changeset
2 @c 2007, 2008, 2009 John W. Eaton
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
3 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
4 @c This file is part of Octave.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
5 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
6 @c Octave is free software; you can redistribute it and/or modify it
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
7 @c under the terms of the GNU General Public License as published by the
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
8 @c Free Software Foundation; either version 3 of the License, or (at
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
9 @c your option) any later version.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
10 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
11 @c Octave is distributed in the hope that it will be useful, but WITHOUT
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
12 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
13 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
14 @c for more details.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
15 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
16 @c You should have received a copy of the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
17 @c along with Octave; see the file COPYING. If not, see
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
18 @c <http://www.gnu.org/licenses/>.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
19
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
20 @node Getting Started
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
21 @chapter Getting Started
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
22
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
23 This chapter explains some of Octave's basic features, including how to
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
24 start an Octave session, get help at the command prompt, edit the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
25 command line, and write Octave programs that can be executed as commands
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
26 from your shell.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
27
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
28 @menu
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
29 * Invoking Octave from the Command Line::
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
30 * Quitting Octave::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
31 * Getting Help::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
32 * Command Line Editing::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
33 * Errors::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
34 * Executable Octave Programs::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
35 * Comments::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
36 @end menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
37
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
38 @node Invoking Octave from the Command Line
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
39 @section Invoking Octave from the Command Line
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
40
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
41 Normally, Octave is used interactively by running the program
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
42 @samp{octave} without any arguments. Once started, Octave reads
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
43 commands from the terminal until you tell it to exit.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
44
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
45 You can also specify the name of a file on the command line, and Octave
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
46 will read and execute the commands from the named file and then exit
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
47 when it is finished.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
48
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
49 You can further control how Octave starts by using the command-line
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
50 options described in the next section, and Octave itself can remind you
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
51 of the options available. Type @samp{octave --help} to display all
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
52 available options and briefly describe their use (@samp{octave -h} is a
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
53 shorter equivalent).
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
54
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
55 @menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
56 * Command Line Options::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
57 * Startup Files::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
58 @end menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
59
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
60 @node Command Line Options
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
61 @subsection Command Line Options
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
62 @cindex Octave command options
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
63 @cindex command options
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
64 @cindex options, Octave command
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
65
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
66 Here is a complete list of the command line options that Octave
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
67 accepts.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
68
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
69
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
70 @table @code
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
71 @item --debug
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
72 @itemx -d
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
73 @cindex @code{--debug}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
74 @cindex @code{-d}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
75 Enter parser debugging mode. Using this option will cause Octave's
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
76 parser to print a lot of information about the commands it reads, and is
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
77 probably only useful if you are actually trying to debug the parser.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
78
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
79 @item --doc-cache-file @var{filename}
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
80 @cindex @code{--doc-cache-file @var{filename}}
8923
d47290508a55 document --doc-cache-file option
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
81 Specify the name of the doc cache file to use. The value of @var{filename}
d47290508a55 document --doc-cache-file option
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
82 specified on the command line will override any value of
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
83 @w{@code{OCTAVE_DOC_CACHE_FILE}} found in the environment, but not any commands
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
84 in the system or user startup files that use the @code{doc_cache_file}
8923
d47290508a55 document --doc-cache-file option
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
85 function.
d47290508a55 document --doc-cache-file option
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
86
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
87 @item --echo-commands
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
88 @itemx -x
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
89 @cindex @code{--echo-commands}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
90 @cindex @code{-x}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
91 Echo commands as they are executed.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
92
5190
2021bbfff5fd [project @ 2005-03-04 02:51:33 by jwe]
jwe
parents: 4476
diff changeset
93 @item --eval @var{code}
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
94 Evaluate @var{code} and exit when finished unless @code{--persist} is also
5190
2021bbfff5fd [project @ 2005-03-04 02:51:33 by jwe]
jwe
parents: 4476
diff changeset
95 specified.
2021bbfff5fd [project @ 2005-03-04 02:51:33 by jwe]
jwe
parents: 4476
diff changeset
96
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
97 @item --exec-path @var{path}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
98 @cindex @code{--exec-path @var{path}}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
99 Specify the path to search for programs to run. The value of @var{path}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
100 specified on the command line will override any value of
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
101 @w{@code{OCTAVE_EXEC_PATH}} found in the environment, but not any commands
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
102 in the system or user startup files that set the built-in variable
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
103 @w{@code{EXEC_PATH}}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
104
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
105 @item --help
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
106 @itemx -h
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
107 @itemx -?
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
108 @cindex @code{--help}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
109 @cindex @code{-h}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
110 @cindex @code{-?}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
111 Print short help message and exit.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
112
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
113 @item --image-path @var{path}
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
114 @cindex @code{--image-path @var{path}}
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
115 Add path to the head of the search path for images. The value of
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
116 @var{path} specified on the command line will override any value of
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
117 @w{@code{OCTAVE_IMAGE_PATH}} found in the environment, but not any commands
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
118 in the system or user startup files that set the built-in variable
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
119 @w{@code{IMAGE_PATH}}.
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
120
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
121 @item --info-file @var{filename}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
122 @cindex @code{--info-file @var{filename}}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
123 Specify the name of the info file to use. The value of @var{filename}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
124 specified on the command line will override any value of
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
125 @w{@code{OCTAVE_INFO_FILE}} found in the environment, but not any commands
6653
673686daec87 [project @ 2007-05-22 15:36:09 by jwe]
jwe
parents: 6643
diff changeset
126 in the system or user startup files that use the @code{info_file}
6477
a441d6681364 [project @ 2007-03-29 13:44:44 by jwe]
jwe
parents: 5775
diff changeset
127 function.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
128
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
129 @item --info-program @var{program}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
130 @cindex @code{--info-program @var{program}}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
131 Specify the name of the info program to use. The value of @var{program}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
132 specified on the command line will override any value of
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
133 @w{@code{OCTAVE_INFO_PROGRAM}} found in the environment, but not any
6477
a441d6681364 [project @ 2007-03-29 13:44:44 by jwe]
jwe
parents: 5775
diff changeset
134 commands in the system or user startup files that use the
a441d6681364 [project @ 2007-03-29 13:44:44 by jwe]
jwe
parents: 5775
diff changeset
135 @code{info_program} function.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
136
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
137 @item --interactive
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
138 @itemx -i
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
139 @cindex @code{--interactive}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
140 @cindex @code{-i}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
141 Force interactive behavior. This can be useful for running Octave via a
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
142 remote shell command or inside an Emacs shell buffer. For another way
9032
349616d9c38e Cleanup top-level documentation menu in octave.texi
Rik <rdrider0-list@yahoo.com>
parents: 8923
diff changeset
143 to run Octave within Emacs, see @ref{Emacs Octave Support}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
144
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
145 @item --line-editing
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
146 @cindex @code{--line-editing}
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
147 Force readline use for command-line editing.
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
148
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
149 @item --no-history
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3402
diff changeset
150 @itemx -H
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
151 @cindex @code{--no-history}
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
152 @cindex @code{-H}
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
153 Disable recording of command-line history.
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3402
diff changeset
154
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
155 @item --no-init-file
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
156 @cindex @code{--no-init-file}
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
157 Don't read the initialization files @file{~/.octaverc} and @file{.octaverc}.
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
158
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
159 @item --no-init-path
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
160 @cindex @code{--no-init-path}
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
161 Don't initialize the search path for function files to include default
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
162 locations.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
163
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
164 @item --no-line-editing
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
165 @cindex @code{--no-line-editing}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
166 Disable command-line editing.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
167
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
168 @item --no-site-file
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
169 @cindex @code{--no-site-file}
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
170 Don't read the site-wide @file{octaverc} initialization files.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
171
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
172 @item --norc
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
173 @itemx -f
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
174 @cindex @code{--norc}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
175 @cindex @code{-f}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
176 Don't read any of the system or user initialization files at startup.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
177 This is equivalent to using both of the options @code{--no-init-file}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
178 and @code{--no-site-file}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
179
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
180 @item --path @var{path}
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
181 @itemx -p @var{path}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
182 @cindex @code{--path @var{path}}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
183 @cindex @code{-p @var{path}}
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
184 Add path to the head of the search path for function files. The
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
185 value of @var{path} specified on the command line will override any value
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
186 of @w{@code{OCTAVE_PATH}} found in the environment, but not any commands in the
6643
6a7fc4105bcc [project @ 2007-05-21 20:37:43 by jwe]
jwe
parents: 6623
diff changeset
187 system or user startup files that set the internal load path through one
6a7fc4105bcc [project @ 2007-05-21 20:37:43 by jwe]
jwe
parents: 6623
diff changeset
188 of the path functions.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
189
5190
2021bbfff5fd [project @ 2005-03-04 02:51:33 by jwe]
jwe
parents: 4476
diff changeset
190 @item --persist
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
191 @cindex @code{--persist}
5190
2021bbfff5fd [project @ 2005-03-04 02:51:33 by jwe]
jwe
parents: 4476
diff changeset
192 Go to interactive mode after @code{--eval} or reading from a file
2021bbfff5fd [project @ 2005-03-04 02:51:33 by jwe]
jwe
parents: 4476
diff changeset
193 named on the command line.
2021bbfff5fd [project @ 2005-03-04 02:51:33 by jwe]
jwe
parents: 4476
diff changeset
194
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
195 @item --silent
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
196 @itemx --quiet
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
197 @itemx -q
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
198 @cindex @code{--silent}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
199 @cindex @code{--quiet}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
200 @cindex @code{-q}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
201 Don't print the usual greeting and version message at startup.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
202
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
203 @item --traditional
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
204 @itemx --braindead
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
205 @cindex @code{--traditional}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
206 @cindex @code{--braindead}
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 9035
diff changeset
207 For compatibility with @sc{matlab}, set initial values for
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
208 user preferences to the following values
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
209
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
210 @example
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
211 @group
7031
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
212 PS1 = ">> "
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
213 PS2 = ""
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
214 beep_on_error = true
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
215 confirm_recursive_rmdir = false
7031
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
216 crash_dumps_octave_core = false
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
217 default_save_options = "-mat-binary"
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
218 fixed_point_format = true
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
219 history_timestamp_format_string
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
220 = "%%-- %D %I:%M %p --%%"
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
221 page_screen_output = false
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
222 print_empty_dimensions = false
6556
8810bbf321ce [project @ 2007-04-20 18:39:40 by jwe]
jwe
parents: 6551
diff changeset
223 @end group
8810bbf321ce [project @ 2007-04-20 18:39:40 by jwe]
jwe
parents: 6551
diff changeset
224 @end example
8810bbf321ce [project @ 2007-04-20 18:39:40 by jwe]
jwe
parents: 6551
diff changeset
225
8810bbf321ce [project @ 2007-04-20 18:39:40 by jwe]
jwe
parents: 6551
diff changeset
226 @noindent
8810bbf321ce [project @ 2007-04-20 18:39:40 by jwe]
jwe
parents: 6551
diff changeset
227 and disable the following warnings
8810bbf321ce [project @ 2007-04-20 18:39:40 by jwe]
jwe
parents: 6551
diff changeset
228 @example
8810bbf321ce [project @ 2007-04-20 18:39:40 by jwe]
jwe
parents: 6551
diff changeset
229 @group
7031
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
230 Octave:fopen-file-in-path
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
231 Octave:function-name-clash
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7018
diff changeset
232 Octave:load-file-in-path
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
233 @end group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
234 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
235
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
236 @item --verbose
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
237 @itemx -V
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
238 @cindex @code{--verbose}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
239 @cindex @code{-V}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
240 Turn on verbose output.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
241
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
242 @item --version
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
243 @itemx -v
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
244 @cindex @code{--version}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
245 @cindex @code{-v}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
246 Print the program version number and exit.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
247
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
248 @item @var{file}
5190
2021bbfff5fd [project @ 2005-03-04 02:51:33 by jwe]
jwe
parents: 4476
diff changeset
249 Execute commands from @var{file}. Exit when done unless
2021bbfff5fd [project @ 2005-03-04 02:51:33 by jwe]
jwe
parents: 4476
diff changeset
250 @code{--persist} is also specified.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
251 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
252
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
253 Octave also includes several functions which return information
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
254 about the command line, including the number of arguments and all of the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
255 options.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
256
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
257 @DOCSTRING(argv)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
258
6550
1b7a6061a05d [project @ 2007-04-20 07:40:26 by jwe]
jwe
parents: 6549
diff changeset
259 @DOCSTRING(program_name)
1b7a6061a05d [project @ 2007-04-20 07:40:26 by jwe]
jwe
parents: 6549
diff changeset
260
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
261 @DOCSTRING(program_invocation_name)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
262
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
263 Here is an example of using these functions to reproduce the command
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
264 line which invoked Octave.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
265
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
266 @example
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
267 @group
6479
2ee8293554a3 [project @ 2007-04-03 15:30:58 by jwe]
jwe
parents: 6477
diff changeset
268 printf ("%s", program_name ());
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
269 arg_list = argv ();
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
270 for i = 1:nargin
6479
2ee8293554a3 [project @ 2007-04-03 15:30:58 by jwe]
jwe
parents: 6477
diff changeset
271 printf (" %s", arg_list@{i@});
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
272 endfor
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
273 printf ("\n");
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
274 @end group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
275 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
276
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
277 @noindent
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
278 @xref{Indexing Cell Arrays}, for an explanation of how to retrieve objects
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
279 from cell arrays, and @ref{Defining Functions}, for information about the
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
280 variable @code{nargin}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
281
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
282 @node Startup Files
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
283 @subsection Startup Files
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
284 @cindex initialization
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
285 @cindex startup
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
286
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
287 When Octave starts, it looks for commands to execute from the files in
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
288 the following list. These files may contain any valid Octave commands,
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
289 including function definitions.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
290
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
291 @cindex startup files
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
292
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
293 @table @code
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
294 @item @var{octave-home}/share/octave/site/m/startup/octaverc
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
295 @cindex site startup file
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
296 where @var{octave-home} is the directory in which Octave is installed
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
297 (the default is @file{@value{OCTAVEHOME}}).
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
298 This file is provided so that changes to the default Octave environment
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
299 can be made globally for all users at your site for all versions of Octave
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
300 you have installed. Care should be taken when making changes to this file
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
301 since all users of Octave at your site will be affected. The default file
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
302 may be overridden by the environment variable @w{@code{OCTAVE_SITE_INITFILE}}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
303
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
304 @item @var{octave-home}/share/octave/@var{version}/m/startup/octaverc
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
305 @cindex version startup file
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
306 where @var{octave-home} is the directory in which Octave is
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
307 installed (the default is @file{@value{OCTAVEHOME}}), and @var{version}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
308 is the version number of Octave. This file is provided so that changes
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
309 to the default Octave environment can be made globally for all users of
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
310 a particular version of Octave. Care should be taken when making
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
311 changes to this file since all users of Octave at your site will be
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
312 affected. The default file may be overridden by the environment variable
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
313 @w{@code{OCTAVE_VERSION_INITFILE}}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
314
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
315 @item ~/.octaverc
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
316 @cindex personal startup file
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
317 @cindex @code{~/.octaverc}
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
318 This file is used to make personal changes to the default
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
319 Octave environment.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
320
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
321 @item .octaverc
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
322 @cindex project startup file
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
323 @cindex @code{.octaverc}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
324 This file can be used to make changes to the default Octave environment
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
325 for a particular project. Octave searches for this file in the current
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
326 directory after it reads @file{~/.octaverc}. Any use of the @code{cd}
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
327 command in the @file{~/.octaverc} file will affect the directory where
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
328 Octave searches for @file{.octaverc}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
329
8347
fa78cb8d8a5c corrections for typos
Brian Gough<bjg@network-theory.co.uk>
parents: 8015
diff changeset
330 If you start Octave in your home directory, commands from the file
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
331 @file{~/.octaverc} will only be executed once.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
332 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
333
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
334 A message will be displayed as each of the startup files is read if you
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
335 invoke Octave with the @code{--verbose} option but without the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
336 @code{--silent} option.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
337
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
338 @node Quitting Octave
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
339 @section Quitting Octave
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
340 @cindex exiting octave
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
341 @cindex quitting octave
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
342
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
343 @DOCSTRING(quit)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
344
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
345 @DOCSTRING(atexit)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
346
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
347 @node Getting Help
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
348 @section Commands for Getting Help
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
349 @cindex on-line help
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
350 @cindex help, on-line
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
351
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
352 The entire text of this manual is available from the Octave prompt
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
353 via the command @kbd{doc}. In addition, the documentation for
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
354 individual user-written functions and variables is also available via
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
355 the @kbd{help} command. This section describes the commands used for
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
356 reading the manual and the documentation strings for user-supplied
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
357 functions and variables. @xref{Function Files}, for more information
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
358 about how to document the functions you write.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
359
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
360 @DOCSTRING(help)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
361
6549
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
362 @DOCSTRING(doc)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
363
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
364 @DOCSTRING(lookfor)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
365
8817
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
366 To see what is new in the current release of Octave, use the @code{news}
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
367 function.
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
368
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
369 @DOCSTRING(news)
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
370
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
371 @DOCSTRING(info)
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
372
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
373 @DOCSTRING(warranty)
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
374
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
375 The following functions can be used to change which programs are used
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
376 for displaying the documentation, and where the documentation can be
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
377 found.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
378
6477
a441d6681364 [project @ 2007-03-29 13:44:44 by jwe]
jwe
parents: 5775
diff changeset
379 @DOCSTRING(info_file)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
380
6477
a441d6681364 [project @ 2007-03-29 13:44:44 by jwe]
jwe
parents: 5775
diff changeset
381 @DOCSTRING(info_program)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
382
6477
a441d6681364 [project @ 2007-03-29 13:44:44 by jwe]
jwe
parents: 5775
diff changeset
383 @DOCSTRING(makeinfo_program)
3686
9507d6de9bbd [project @ 2000-06-29 16:30:44 by jwe]
jwe
parents: 3439
diff changeset
384
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
385 @DOCSTRING(doc_cache_file)
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9132
diff changeset
386
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
387 @DOCSTRING(suppress_verbose_help_message)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
388
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
389 @node Command Line Editing
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
390 @section Command Line Editing
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
391 @cindex command-line editing
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
392 @cindex editing the command line
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
393
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
394 Octave uses the GNU Readline library to provide an extensive set of
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
395 command-line editing and history features. Only the most common
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
396 features are described in this manual. In addition, all of the editing
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
397 functions can be bound to different key strokes at the user's discretion.
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
398 This manual assumes no changes from the default Emacs bindings. See the GNU
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
399 Readline Library manual for more information on customizing Readline and
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
400 for a complete feature list.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
401
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
402 To insert printing characters (letters, digits, symbols, etc.), simply
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
403 type the character. Octave will insert the character at the cursor and
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
404 advance the cursor forward.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
405
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
406 Many of the command-line editing functions operate using control
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
407 characters. For example, the character @kbd{Control-a} moves the cursor
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
408 to the beginning of the line. To type @kbd{C-a}, hold down @key{CTRL}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
409 and then press @key{a}. In the following sections, control characters
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
410 such as @kbd{Control-a} are written as @kbd{C-a}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
411
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
412 Another set of command-line editing functions use Meta characters. To
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
413 type @kbd{M-u}, hold down the @key{META} key and press @key{u}. Depending
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
414 on the keyboard, the @key{META} key may be labeled @key{ALT} or
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
415 even @key{WINDOWS}. If your terminal does not have a @key{META} key, you
7001
8b0cfeb06365 [project @ 2007-10-10 18:02:59 by jwe]
jwe
parents: 6939
diff changeset
416 can still type Meta characters using two-character sequences starting
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
417 with @kbd{ESC}. Thus, to enter @kbd{M-u}, you would type
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
418 @key{ESC} @key{u}. The @kbd{ESC} character sequences are also allowed on
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
419 terminals with real Meta keys. In the following sections, Meta
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
420 characters such as @kbd{Meta-u} are written as @kbd{M-u}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
421
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3402
diff changeset
422
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
423 @menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
424 * Cursor Motion::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
425 * Killing and Yanking::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
426 * Commands For Text::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
427 * Commands For Completion::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
428 * Commands For History::
3439
3234a698073a [project @ 2000-01-14 09:51:14 by jwe]
jwe
parents: 3428
diff changeset
429 * Customizing readline::
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
430 * Customizing the Prompt::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
431 * Diary and Echo Commands::
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
432 @end menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
433
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
434 @node Cursor Motion
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
435 @subsection Cursor Motion
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
436
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
437 The following commands allow you to position the cursor.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
438
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
439 @table @kbd
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
440 @item C-b
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
441 Move back one character.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
442
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
443 @item C-f
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
444 Move forward one character.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
445
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
446 @item @key{DEL}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
447 Delete the character to the left of the cursor.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
448
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
449 @item C-d
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
450 Delete the character underneath the cursor.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
451
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
452 @item M-f
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
453 Move forward a word.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
454
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
455 @item M-b
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
456 Move backward a word.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
457
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
458 @item C-a
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
459 Move to the start of the line.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
460
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
461 @item C-e
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
462 Move to the end of the line.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
463
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
464 @item C-l
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
465 Clear the screen, reprinting the current line at the top.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
466
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
467 @item C-_
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
468 @itemx C-/
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
469 Undo the last action. You can undo all the way back to an empty line.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
470
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
471 @item M-r
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
472 Undo all changes made to this line. This is like typing the `undo'
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
473 command enough times to get back to the beginning.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
474 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
475
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
476 The above table describes the most basic possible keystrokes that you need
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
477 in order to do editing of the input line. On most terminals, you can
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
478 also use the left and right arrow keys in place of @kbd{C-f} and @kbd{C-b}
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
479 to move forward and backward.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
480
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
481 Notice how @kbd{C-f} moves forward a character, while @kbd{M-f} moves
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
482 forward a word. It is a loose convention that control keystrokes
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
483 operate on characters while meta keystrokes operate on words.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
484
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
485 @cindex clearing the screen
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
486
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
487 The function @code{clc} will allow you to clear the screen from within
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
488 Octave programs.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
489
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
490 @DOCSTRING(clc)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
491
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
492 @node Killing and Yanking
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
493 @subsection Killing and Yanking
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
494
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
495 @dfn{Killing} text means to delete the text from the line, but to save
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
496 it away for later use, usually by @dfn{yanking} it back into the line.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
497 If the description for a command says that it `kills' text, then you can
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
498 be sure that you can get the text back in a different (or the same)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
499 place later.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
500
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
501 Here is the list of commands for killing text.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
502
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
503 @table @kbd
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
504 @item C-k
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
505 Kill the text from the current cursor position to the end of the line.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
506
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
507 @item M-d
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
508 Kill from the cursor to the end of the current word, or if between
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
509 words, to the end of the next word.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
510
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
511 @item M-@key{DEL}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
512 Kill from the cursor to the start of the previous word, or if between
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
513 words, to the start of the previous word.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
514
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
515 @item C-w
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
516 Kill from the cursor to the previous whitespace. This is different than
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
517 @kbd{M-@key{DEL}} because the word boundaries differ.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
518 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
519
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
520 And, here is how to @dfn{yank} the text back into the line. Yanking
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
521 means to copy the most-recently-killed text from the kill buffer.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
522
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
523 @table @kbd
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
524 @item C-y
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
525 Yank the most recently killed text back into the buffer at the cursor.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
526
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
527 @item M-y
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
528 Rotate the kill-ring, and yank the new top. You can only do this if
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
529 the prior command is @kbd{C-y} or @kbd{M-y}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
530 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
531
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
532 When you use a kill command, the text is saved in a @dfn{kill-ring}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
533 Any number of consecutive kills save all of the killed text together, so
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
534 that when you yank it back, you get it in one clean sweep. The kill
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
535 ring is not line specific; the text that you killed on a previously
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
536 typed line is available to be yanked back later, when you are typing
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
537 another line.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
538
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
539 @node Commands For Text
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
540 @subsection Commands For Changing Text
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
541
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
542 The following commands can be used for entering characters that would
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
543 otherwise have a special meaning (e.g., @key{TAB}, @kbd{C-q}, etc.), or
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
544 for quickly correcting typing mistakes.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
545
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
546 @table @kbd
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
547 @item C-q
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
548 @itemx C-v
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
549 Add the next character that you type to the line verbatim. This is
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
550 how to insert things like @kbd{C-q} for example.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
551
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
552 @item M-@key{TAB}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
553 Insert a tab character.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
554
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
555 @item C-t
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
556 Drag the character before the cursor forward over the character at the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
557 cursor, also moving the cursor forward. If the cursor is at the end of
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
558 the line, then transpose the two characters before it.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
559
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
560 @item M-t
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
561 Drag the word behind the cursor past the word in front of the cursor
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
562 moving the cursor over that word as well.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
563
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
564 @item M-u
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
565 Uppercase the characters following the cursor to the end of the current
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
566 (or following) word, moving the cursor to the end of the word.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
567
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
568 @item M-l
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
569 Lowercase the characters following the cursor to the end of the current
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
570 (or following) word, moving the cursor to the end of the word.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
571
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
572 @item M-c
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
573 Uppercase the character following the cursor (or the beginning of the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
574 next word if the cursor is between words), moving the cursor to the end
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
575 of the word.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
576 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
577
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
578 @node Commands For Completion
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
579 @subsection Letting Readline Type For You
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
580 @cindex command completion
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
581
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
582 The following commands allow Octave to complete command and variable
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
583 names for you.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
584
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
585 @table @kbd
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
586 @item @key{TAB}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
587 Attempt to do completion on the text before the cursor. Octave can
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
588 complete the names of commands and variables.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
589
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
590 @item M-?
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
591 List the possible completions of the text before the cursor.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
592 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
593
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
594 @DOCSTRING(completion_append_char)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
595
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
596 @DOCSTRING(completion_matches)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
597
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
598 @node Commands For History
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
599 @subsection Commands For Manipulating The History
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
600 @cindex command history
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
601 @cindex input history
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
602 @cindex history of commands
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
603
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
604 Octave normally keeps track of the commands you type so that you can
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
605 recall previous commands to edit or execute them again. When you exit
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
606 Octave, the most recent commands you have typed, up to the number
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
607 specified by the variable @code{history_size}, are saved in a file.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
608 When Octave starts, it loads an initial list of commands from the file
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
609 named by the variable @code{history_file}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
610
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
611 Here are the commands for simple browsing and searching the history
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
612 list.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
613
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
614 @table @kbd
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
615 @item @key{LFD}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
616 @itemx @key{RET}
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
617 Accept the current line regardless of where the cursor is. If the line is
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
618 non-empty, add it to the history list. If the line was a history
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
619 line, then restore the history line to its original state.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
620
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
621 @item C-p
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
622 Move `up' through the history list.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
623
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
624 @item C-n
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
625 Move `down' through the history list.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
626
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
627 @item M-<
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
628 Move to the first line in the history.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
629
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
630 @item M->
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
631 Move to the end of the input history, i.e., the line you are entering!
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
632
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
633 @item C-r
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
634 Search backward starting at the current line and moving `up' through
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
635 the history as necessary. This is an incremental search.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
636
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
637 @item C-s
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
638 Search forward starting at the current line and moving `down' through
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
639 the history as necessary.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
640 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
641
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
642 On most terminals, you can also use the up and down arrow keys in place
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
643 of @kbd{C-p} and @kbd{C-n} to move through the history list.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
644
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
645 In addition to the keyboard commands for moving through the history
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
646 list, Octave provides three functions for viewing, editing, and
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
647 re-running chunks of commands from the history list.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
648
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
649 @DOCSTRING(history)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
650
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
651 @DOCSTRING(edit_history)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
652
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
653 @DOCSTRING(run_history)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
654
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
655 @noindent
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
656 Octave also allows you customize the details of when, where, and how history
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
657 is saved.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
658
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
659 @DOCSTRING(saving_history)
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
660
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
661 @DOCSTRING(history_file)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
662
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
663 @DOCSTRING(history_size)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
664
6550
1b7a6061a05d [project @ 2007-04-20 07:40:26 by jwe]
jwe
parents: 6549
diff changeset
665 @DOCSTRING(history_timestamp_format_string)
1b7a6061a05d [project @ 2007-04-20 07:40:26 by jwe]
jwe
parents: 6549
diff changeset
666
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
667 @DOCSTRING(EDITOR)
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
668
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
669 @node Customizing readline
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3402
diff changeset
670 @subsection Customizing @code{readline}
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
671 @cindex @file{~/.inputrc}
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
672 @cindex customizing @code{readline}
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
673 @cindex @code{readline} customization
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3402
diff changeset
674
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
675 Octave uses the GNU Readline library for command-line editing and
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
676 history features. Readline is very flexible and can be modified through
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
677 a configuration file of commands (See the GNU Readline library for the
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
678 exact command syntax). The default configuration file is normally
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
679 @file{~/.inputrc}.
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
680
9134
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
681 Octave provides two commands for initializing Readline and thereby changing
a3739e27b017 Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9133
diff changeset
682 the command line behavior.
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3402
diff changeset
683
3439
3234a698073a [project @ 2000-01-14 09:51:14 by jwe]
jwe
parents: 3428
diff changeset
684 @DOCSTRING(read_readline_init_file)
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3402
diff changeset
685
8817
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
686 @DOCSTRING(re_read_readline_init_file)
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8347
diff changeset
687
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
688 @node Customizing the Prompt
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
689 @subsection Customizing the Prompt
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
690 @cindex prompt customization
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
691 @cindex customizing the prompt
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
692
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
693 The following variables are available for customizing the appearance of
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
694 the command-line prompts. Octave allows the prompt to be customized by
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
695 inserting a number of backslash-escaped special characters that are
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
696 decoded as follows:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
697
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
698 @table @samp
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
699 @item \t
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
700 The time.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
701
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
702 @item \d
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
703 The date.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
704
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
705 @item \n
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
706 Begins a new line by printing the equivalent of a carriage return
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
707 followed by a line feed.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
708
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
709 @item \s
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
710 The name of the program (usually just @samp{octave}).
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
711
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
712 @item \w
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
713 The current working directory.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
714
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
715 @item \W
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
716 The basename of the current working directory.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
717
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
718 @item \u
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
719 The username of the current user.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
720
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
721 @item \h
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
722 The hostname, up to the first `.'.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
723
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
724 @item \H
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
725 The hostname.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
726
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
727 @item \#
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
728 The command number of this command, counting from when Octave starts.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
729
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
730 @item \!
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
731 The history number of this command. This differs from @samp{\#} by the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
732 number of commands in the history list when Octave starts.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
733
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
734 @item \$
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
735 If the effective UID is 0, a @samp{#}, otherwise a @samp{$}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
736
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
737 @item \nnn
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
738 The character whose character code in octal is @var{nnn}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
739
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
740 @item \\
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
741 A backslash.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
742 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
743
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
744 @DOCSTRING(PS1)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
745
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
746 @DOCSTRING(PS2)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
747
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
748 @DOCSTRING(PS4)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
749
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
750 @node Diary and Echo Commands
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
751 @subsection Diary and Echo Commands
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
752 @cindex diary of commands and output
6939
46d1ad37d943 [project @ 2007-10-01 16:12:20 by jwe]
jwe
parents: 6778
diff changeset
753 @cindex command and output logs
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
754 @cindex logging commands and output
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
755 @cindex echoing executing commands
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
756 @cindex command echoing
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
757
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
758 Octave's diary feature allows you to keep a log of all or part of an
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
759 interactive session by recording the input you type and the output that
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
760 Octave produces in a separate file.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
761
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
762 @DOCSTRING(diary)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
763
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
764 Sometimes it is useful to see the commands in a function or script as
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
765 they are being evaluated. This can be especially helpful for debugging
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
766 some kinds of problems.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
767
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
768 @DOCSTRING(echo)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
769
3332
7c03933635c6 [project @ 1999-11-02 06:57:12 by jwe]
jwe
parents: 3294
diff changeset
770 @DOCSTRING(echo_executing_commands)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
771
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
772 @node Errors
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
773 @section How Octave Reports Errors
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
774 @cindex error messages
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
775 @cindex messages, error
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
776
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
777 Octave reports two kinds of errors for invalid programs.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
778
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
779 A @dfn{parse error} occurs if Octave cannot understand something you
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
780 have typed. For example, if you misspell a keyword,
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
781
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
782 @example
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
783 octave:13> function y = f (x) y = x***2; endfunction
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
784 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
785
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
786 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
787 Octave will respond immediately with a message like this:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
788
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
789 @example
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
790 @group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
791 parse error:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
792
8015
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7031
diff changeset
793 syntax error
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7031
diff changeset
794
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
795 >>> function y = f (x) y = x***2; endfunction
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
796 ^
9132
eb1747dbd360 Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
797 @end group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
798 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
799
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
800 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
801 For most parse errors, Octave uses a caret (@samp{^}) to mark the point
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
802 on the line where it was unable to make sense of your input. In this
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
803 case, Octave generated an error message because the keyword for
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
804 exponentiation (@code{**}) was misspelled. It marked the error at the
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
805 third @samp{*} because the code leading up to this was correct but the final
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
806 @samp{*} was not understood.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
807
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
808 Another class of error message occurs at evaluation time. These
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
809 errors are called @dfn{run-time errors}, or sometimes
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
810 @dfn{evaluation errors}, because they occur when your program is being
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
811 @dfn{run}, or @dfn{evaluated}. For example, if after correcting the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
812 mistake in the previous function definition, you type
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
813
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
814 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
815 octave:13> f ()
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
816 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
817
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
818 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
819 Octave will respond with
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
820
9153
5247e89688e1 Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents: 9135
diff changeset
821 @example
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
822 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
823 error: `x' undefined near line 1 column 24
8015
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7031
diff changeset
824 error: called from:
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7031
diff changeset
825 error: f at line 1, column 22
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
826 @end group
9153
5247e89688e1 Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents: 9135
diff changeset
827 @end example
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
828
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
829 @noindent
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
830 This error message has several parts, and gives quite a bit of
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
831 information to help you locate the source of the error. The messages
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
832 are generated from the point of the innermost error, and provide a
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
833 traceback of enclosing expressions and function calls.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
834
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
835 In the example above, the first line indicates that a variable named
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
836 @samp{x} was found to be undefined near line 1 and column 24 of some
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
837 function or expression. For errors occurring within functions, lines
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
838 are counted from the beginning of the file containing the function
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
839 definition. For errors occurring outside of an enclosing function,
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
840 the line number indicates the input line number, which is usually displayed
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
841 in the primary prompt string.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
842
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
843 The second and third lines of the error message indicate that the error
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
844 occurred within the function @code{f}. If the function @code{f} had been
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
845 called from within another function, for example, @code{g}, the list of
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
846 errors would have ended with one more line:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
847
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
848 @example
8015
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7031
diff changeset
849 error: g at line 1, column 17
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
850 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
851
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
852 These lists of function calls make it fairly easy to trace the
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
853 path your program took before the error occurred, and to correct the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
854 error before trying again.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
855
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
856 @node Executable Octave Programs
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
857 @section Executable Octave Programs
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
858 @cindex executable scripts
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
859 @cindex scripts
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
860 @cindex batch processing
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
861 @cindex self contained programs
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
862 @cindex program, self contained
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
863 @cindex @samp{#!}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
864
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
865 Once you have learned Octave, you may want to write self-contained
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
866 Octave scripts, using the @samp{#!} script mechanism. You can do this
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
867 on GNU systems and on many Unix systems @footnote{The @samp{#!}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
868 mechanism works on Unix systems derived from Berkeley Unix, System V
6481
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
869 Release 4, and some System V Release 3 systems.}.
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
870
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
871 Self-contained Octave scripts are useful when you want to write a
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
872 program which users can invoke without knowing that the program is
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
873 written in the Octave language. Octave scripts are also used for batch
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
874 processing of data files. Once an algorithm has been developed and tested
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
875 in the interactive portion of Octave, it can be committed to an executable
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
876 script and used again and again on new data files.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
877
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
878 As a trivial example of an executable Octave script, you might create a
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
879 text file named @file{hello}, containing the following lines:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
880
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
881 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
882 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
883 #! @var{octave-interpreter-name} -qf
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
884 # a sample Octave program
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
885 printf ("Hello, world!\n");
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
886 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
887 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
888
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
889 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
890 (where @var{octave-interpreter-name} should be replaced with the full
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
891 path and name of your Octave binary). Note that this will only work if
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
892 @samp{#!} appears at the very beginning of the file. After making the
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
893 file executable (with the @code{chmod} command on Unix systems), you can
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
894 simply type:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
895
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
896 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
897 hello
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
898 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
899
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
900 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
901 at the shell, and the system will arrange to run Octave as if you had
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
902 typed:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
903
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
904 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
905 octave hello
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
906 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
907
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
908 The line beginning with @samp{#!} lists the full path and filename of an
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
909 interpreter to be run, and an optional initial command line argument to
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
910 pass to that interpreter. The operating system then runs the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
911 interpreter with the given argument and the full argument list of the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
912 executed program. The first argument in the list is the full file name
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
913 of the Octave executable. The rest of the argument list will either be
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
914 options to Octave, or data files, or both. The @samp{-qf} options are
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
915 usually specified in stand-alone Octave programs to prevent them from
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
916 printing the normal startup message, and to keep them from behaving
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
917 differently depending on the contents of a particular user's
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
918 @file{~/.octaverc} file. @xref{Invoking Octave from the Command Line}.
6481
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
919
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
920 Note that some operating systems may place a limit on the number of
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
921 characters that are recognized after @samp{#!}. Also, the arguments
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
922 appearing in a @samp{#!} line are parsed differently by various
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
923 shells/systems. The majority of them group all the arguments together in one
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
924 string and pass it to the interpreter as a single argument. In this case, the
6481
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
925 following script:
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
926
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
927 @example
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
928 @group
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
929 #! @var{octave-interpreter-name} -q -f # comment
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
930 @end group
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
931 @end example
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
932
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
933 @noindent
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
934 is equivalent to typing at the command line:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
935
6481
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
936 @example
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
937 @group
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
938 octave "-q -f # comment"
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
939 @end group
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
940 @end example
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
941
6481
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
942 @noindent
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
943 which will produce an error message. Unfortunately, it is
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
944 not possible for Octave to determine whether it has been called from the
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
945 command line or from a @samp{#!} script, so some care is needed when using the
6481
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
946 @samp{#!} mechanism.
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
947
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
948 Note that when Octave is started from an executable script, the built-in
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
949 function @code{argv} returns a cell array containing the command line
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
950 arguments passed to the executable Octave script, not the arguments
6481
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
951 passed to the Octave interpreter on the @samp{#!} line of the script.
89ed13fec6fe [project @ 2007-04-03 19:39:11 by jwe]
jwe
parents: 6479
diff changeset
952 For example, the following program will reproduce the command line that
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
953 was used to execute the script, not @samp{-qf}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
954
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
955 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
956 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
957 #! /bin/octave -qf
6479
2ee8293554a3 [project @ 2007-04-03 15:30:58 by jwe]
jwe
parents: 6477
diff changeset
958 printf ("%s", program_name ());
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6556
diff changeset
959 arg_list = argv ();
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
960 for i = 1:nargin
6479
2ee8293554a3 [project @ 2007-04-03 15:30:58 by jwe]
jwe
parents: 6477
diff changeset
961 printf (" %s", arg_list@{i@});
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
962 endfor
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
963 printf ("\n");
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
964 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
965 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
966
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3974
diff changeset
967 @node Comments
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
968 @section Comments in Octave Programs
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
969 @cindex comments
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
970 @cindex use of comments
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
971 @cindex documenting Octave programs
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
972
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
973 A @dfn{comment} is some text that is included in a program for the sake
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
974 of human readers, and which is NOT an executable part of the program.
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
975 Comments can explain what the program does, and how it works. Nearly all
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
976 programming languages have provisions for comments, because programs are
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
977 typically hard to understand without them.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
978
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
979 @menu
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
980 * Single Line Comments::
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
981 * Block Comments::
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
982 * Comments and the Help System::
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
983 @end menu
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
984
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
985 @node Single Line Comments
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
986 @subsection Single Line Comments
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
987 @cindex @samp{#}
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
988 @cindex @samp{%}
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
989
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
990 In the Octave language, a comment starts with either the sharp sign
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
991 character, @samp{#}, or the percent symbol @samp{%} and continues to the
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
992 end of the line. Any text following the sharp sign or percent symbol is
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
993 ignored by the Octave interpreter and not executed. The following example
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
994 shows whole line and partial line comments.
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
995 @example
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
996 @group
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
997 function countdown
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
998 # Count down for main rocket engines
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
999 disp(3);
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1000 disp(2);
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1001 disp(1);
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1002 disp("Blast Off!"); # Rocket leaves pad
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1003 endfunction
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1004 @end group
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1005 @end example
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1006
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1007 @node Block Comments
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1008 @subsection Block Comments
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
1009 @cindex block comments
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1010 @cindex multi-line comments
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1011 @cindex @samp{#@{}
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1012 @cindex @samp{%@{}
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1013
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1014 Entire blocks of code can be commented by enclosing the code between
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1015 matching @samp{#@{} and @samp{#@}} or @samp{%@{} and @samp{%@}} markers.
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1016 For example,
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1017 @example
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1018 @group
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1019 function quick_countdown
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1020 # Count down for main rocket engines
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1021 disp(3);
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1022 #@{
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1023 disp(2);
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1024 disp(1);
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1025 #@}
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1026 disp("Blast Off!"); # Rocket leaves pad
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1027 endfunction
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1028 @end group
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1029 @end example
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1030
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1031 @noindent
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1032 will produce a very quick countdown from '3' to 'Blast Off' as the
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
1033 lines "@code{disp(2);}" and "@code{disp(1);}" won't be executed.
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1034
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1035 @node Comments and the Help System
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1036 @subsection Comments and the Help System
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1037 @cindex documenting functions
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1038 @cindex documenting user scripts
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1039 @cindex help, user-defined functions
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1040
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1041 The @code{help} command (@pxref{Getting Help}) is able to find the first
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
1042 block of comments in a function and return those as a documentation
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
1043 string. This means that the same commands used to get help
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
1044 on built-in functions are available for properly formatted user-defined
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
1045 functions. For example, after defining the function @code{f} below,
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1046 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1047 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1048 function xdot = f (x, t)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1049
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1050 # usage: f (x, t)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1051 #
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1052 # This function defines the right-hand
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1053 # side functions for a set of nonlinear
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1054 # differential equations.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1055
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1056 r = 0.25;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1057 @dots{}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1058 endfunction
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1059 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1060 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1061
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1062 the command @kbd{help f} produces the output
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1063
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1064 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1065 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1066 usage: f (x, t)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1067
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1068 This function defines the right-hand
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1069 side functions for a set of nonlinear
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1070 differential equations.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1071 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1072 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1073
9135
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
1074 Although it is possible to put comment lines into keyboard-composed,
b04f95fabbf9 Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 9134
diff changeset
1075 throw-away Octave programs, it usually isn't very useful because the
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1076 purpose of a comment is to help you or another person understand the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1077 program at a later time.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
1078
9035
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1079 The @code{help} parser currently only recognizes single line comments
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1080 (@pxref{Single Line Comments}) and not block comments for the initial
57649dcecb55 Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents: 9032
diff changeset
1081 help text.