Mercurial > octave
annotate doc/interpreter/basics.txi @ 31191:bb9d776eafac stable
Fix wrong color in PDF printout of some latex strings (bug #62884)
* octave-svgconvert (draw): For "rect" elements only set brush color if
necessary and eventually restore to previous color.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Sun, 14 Aug 2022 18:24:07 +0200 |
parents | 796f54d4ddbf |
children | 4b80982e0af8 |
rev | line source |
---|---|
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30321
diff
changeset
|
1 @c Copyright (C) 1996-2022 The Octave Project Developers |
7018 | 2 @c |
3 @c This file is part of Octave. | |
4 @c | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24507
diff
changeset
|
5 @c Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22475
diff
changeset
|
6 @c under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24507
diff
changeset
|
7 @c the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22475
diff
changeset
|
8 @c (at your option) any later version. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
9 @c |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22475
diff
changeset
|
10 @c Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22475
diff
changeset
|
11 @c WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22475
diff
changeset
|
12 @c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22475
diff
changeset
|
13 @c GNU General Public License for more details. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
14 @c |
7018 | 15 @c You should have received a copy of the GNU General Public License |
16 @c along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24507
diff
changeset
|
17 @c <https://www.gnu.org/licenses/>. |
3294 | 18 |
4167 | 19 @node Getting Started |
3294 | 20 @chapter Getting Started |
21 | |
22 This chapter explains some of Octave's basic features, including how to | |
23 start an Octave session, get help at the command prompt, edit the | |
24 command line, and write Octave programs that can be executed as commands | |
25 from your shell. | |
26 | |
27 @menu | |
17152
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
28 * Invoking Octave from the Command Line:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
29 * Quitting Octave:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
30 * Getting Help:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
31 * Command Line Editing:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
32 * Errors:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
33 * Executable Octave Programs:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
34 * Comments:: |
3294 | 35 @end menu |
36 | |
6620 | 37 @node Invoking Octave from the Command Line |
38 @section Invoking Octave from the Command Line | |
3294 | 39 |
40 Normally, Octave is used interactively by running the program | |
41 @samp{octave} without any arguments. Once started, Octave reads | |
42 commands from the terminal until you tell it to exit. | |
43 | |
44 You can also specify the name of a file on the command line, and Octave | |
45 will read and execute the commands from the named file and then exit | |
46 when it is finished. | |
47 | |
48 You can further control how Octave starts by using the command-line | |
49 options described in the next section, and Octave itself can remind you | |
50 of the options available. Type @samp{octave --help} to display all | |
51 available options and briefly describe their use (@samp{octave -h} is a | |
52 shorter equivalent). | |
53 | |
54 @menu | |
17152
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
55 * Command Line Options:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
56 * Startup Files:: |
3294 | 57 @end menu |
58 | |
4167 | 59 @node Command Line Options |
3294 | 60 @subsection Command Line Options |
61 @cindex Octave command options | |
62 @cindex command options | |
63 @cindex options, Octave command | |
64 | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
65 Here is a complete list of the command line options that Octave |
3294 | 66 accepts. |
67 | |
6620 | 68 |
3294 | 69 @table @code |
16807
2fd22fbaffa3
doc: Add built_in_docstrings_file() to documentation.
Rik <rik@octave.org>
parents:
16774
diff
changeset
|
70 |
2fd22fbaffa3
doc: Add built_in_docstrings_file() to documentation.
Rik <rik@octave.org>
parents:
16774
diff
changeset
|
71 @item --built-in-docstrings-file @var{filename} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
72 @cindex @sortas{options, Octave command --built-in-docstrings-file} @ @ @code{--built-in-docstrings-file @var{filename}} |
16807
2fd22fbaffa3
doc: Add built_in_docstrings_file() to documentation.
Rik <rik@octave.org>
parents:
16774
diff
changeset
|
73 Specify the name of the file containing documentation strings for the |
2fd22fbaffa3
doc: Add built_in_docstrings_file() to documentation.
Rik <rik@octave.org>
parents:
16774
diff
changeset
|
74 built-in functions of Octave. This value is normally correct and should |
2fd22fbaffa3
doc: Add built_in_docstrings_file() to documentation.
Rik <rik@octave.org>
parents:
16774
diff
changeset
|
75 only need to specified in extraordinary situations. |
2fd22fbaffa3
doc: Add built_in_docstrings_file() to documentation.
Rik <rik@octave.org>
parents:
16774
diff
changeset
|
76 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
77 @item --debug |
3294 | 78 @itemx -d |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
79 @cindex @sortas{options, Octave command --debug} @ @ @code{--debug} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
80 @cindex @sortas{options, Octave command -d} @ @ @code{-d} |
3294 | 81 Enter parser debugging mode. Using this option will cause Octave's |
82 parser to print a lot of information about the commands it reads, and is | |
83 probably only useful if you are actually trying to debug the parser. | |
84 | |
16807
2fd22fbaffa3
doc: Add built_in_docstrings_file() to documentation.
Rik <rik@octave.org>
parents:
16774
diff
changeset
|
85 @item --doc-cache-file @var{filename} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
86 @cindex @sortas{options, Octave command --doc-cache-file} @ @ @code{--doc-cache-file @var{filename}} |
8923
d47290508a55
document --doc-cache-file option
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
87 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
|
88 specified on the command line will override any value of |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
89 @w{@env{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
|
90 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
|
91 function. |
d47290508a55
document --doc-cache-file option
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
92 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
93 @item --echo-commands |
3294 | 94 @itemx -x |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
95 @cindex @sortas{options, Octave command --echo-commands} @ @ @code{--echo-commands} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
96 @cindex @sortas{options, Octave command -x} @ @ @code{-x} |
3294 | 97 Echo commands as they are executed. |
98 | |
5190 | 99 @item --eval @var{code} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
100 @cindex @sortas{options, Octave command --eval} @ @ @code{--eval @var{code}} |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
101 Evaluate @var{code} and exit when finished unless @option{--persist} is also |
5190 | 102 specified. |
103 | |
3294 | 104 @item --exec-path @var{path} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
105 @cindex @sortas{options, Octave command --exec-path} @ @ @code{--exec-path @var{path}} |
3294 | 106 Specify the path to search for programs to run. The value of @var{path} |
107 specified on the command line will override any value of | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
108 @w{@env{OCTAVE_EXEC_PATH}} found in the environment, but not any commands |
28652
bb0ca2753bc2
update docs for built-in variables (bug #58988)
John W. Eaton <jwe@octave.org>
parents:
28506
diff
changeset
|
109 in the system or user startup files that call the |
bb0ca2753bc2
update docs for built-in variables (bug #58988)
John W. Eaton <jwe@octave.org>
parents:
28506
diff
changeset
|
110 @w{@env{EXEC_PATH}} function. |
3294 | 111 |
25188
bd0631439f8c
doc: document the --gui command-line options, update description of --no-gui
Mike Miller <mtmiller@octave.org>
parents:
25184
diff
changeset
|
112 @item --gui |
bd0631439f8c
doc: document the --gui command-line options, update description of --no-gui
Mike Miller <mtmiller@octave.org>
parents:
25184
diff
changeset
|
113 @cindex @sortas{options, Octave command --gui} @ @ @code{--gui} |
bd0631439f8c
doc: document the --gui command-line options, update description of --no-gui
Mike Miller <mtmiller@octave.org>
parents:
25184
diff
changeset
|
114 Start the graphical user interface (GUI). |
15540
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
115 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
116 @item --help |
3294 | 117 @itemx -h |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
118 @cindex @sortas{options, Octave command --help} @ @ @code{--help} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
119 @cindex @sortas{options, Octave command -h} @ @ @code{-h} |
3294 | 120 Print short help message and exit. |
121 | |
6620 | 122 @item --image-path @var{path} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
123 @cindex @sortas{options, Octave command --image-path} @ @ @code{--image-path @var{path}} |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
124 Add path to the head of the search path for images. The value of |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
125 @var{path} specified on the command line will override any value of |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
126 @w{@env{OCTAVE_IMAGE_PATH}} found in the environment, but not any commands |
28652
bb0ca2753bc2
update docs for built-in variables (bug #58988)
John W. Eaton <jwe@octave.org>
parents:
28506
diff
changeset
|
127 in the system or user startup files that call the @w{@env{IMAGE_PATH}} |
bb0ca2753bc2
update docs for built-in variables (bug #58988)
John W. Eaton <jwe@octave.org>
parents:
28506
diff
changeset
|
128 function. |
6620 | 129 |
3294 | 130 @item --info-file @var{filename} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
131 @cindex @sortas{options, Octave command --info-file} @ @ @code{--info-file @var{filename}} |
3294 | 132 Specify the name of the info file to use. The value of @var{filename} |
133 specified on the command line will override any value of | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
134 @w{@env{OCTAVE_INFO_FILE}} found in the environment, but not any commands |
6653 | 135 in the system or user startup files that use the @code{info_file} |
6477 | 136 function. |
3294 | 137 |
138 @item --info-program @var{program} | |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
139 @cindex @sortas{options, Octave command --info-program} @ @ @code{--info-program @var{program}} |
3294 | 140 Specify the name of the info program to use. The value of @var{program} |
141 specified on the command line will override any value of | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
142 @w{@env{OCTAVE_INFO_PROGRAM}} found in the environment, but not any |
6477 | 143 commands in the system or user startup files that use the |
144 @code{info_program} function. | |
3294 | 145 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
146 @item --interactive |
3294 | 147 @itemx -i |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
148 @cindex @sortas{options, Octave command --interactive} @ @ @code{--interactive} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
149 @cindex @sortas{options, Octave command -i} @ @ @code{-i} |
3294 | 150 Force interactive behavior. This can be useful for running Octave via a |
22475
e511f86fb230
doc: Remove Emacs chapter from manual.
Rik <rik@octave.org>
parents:
22342
diff
changeset
|
151 remote shell command or inside an Emacs shell buffer. |
3294 | 152 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
153 @item --line-editing |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
154 @cindex @sortas{options, Octave command --line-editing} @ @ @code{--line-editing} |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
155 Force readline use for command-line editing. |
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
156 |
15540
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
157 @item --no-gui |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
158 @cindex @sortas{options, Octave command --no-gui} @ @ @code{--no-gui} |
15540
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
159 Disable the graphical user interface (GUI) and use the command line |
25188
bd0631439f8c
doc: document the --gui command-line options, update description of --no-gui
Mike Miller <mtmiller@octave.org>
parents:
25184
diff
changeset
|
160 interface (CLI) instead. This is the default behavior, but this option |
bd0631439f8c
doc: document the --gui command-line options, update description of --no-gui
Mike Miller <mtmiller@octave.org>
parents:
25184
diff
changeset
|
161 may be useful to override a previous @option{--gui}. |
15540
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
162 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
163 @item --no-history |
3428 | 164 @itemx -H |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
165 @cindex @sortas{options, Octave command --no-history} @ @ @code{--no-history} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
166 @cindex @sortas{options, Octave command -H} @ @ @code{-H} |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
167 Disable recording of command-line history. |
3428 | 168 |
3294 | 169 @item --no-init-file |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
170 @cindex @sortas{options, Octave command --no-init-file} @ @ @code{--no-init-file} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
171 @cindex @sortas{octaverc ~/.octaverc} @code{~/.octaverc} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
172 @cindex @sortas{octaverc .octaverc} @code{.octaverc} |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
173 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
|
174 |
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
175 @item --no-init-path |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
176 @cindex @sortas{options, Octave command --no-init-path} @ @ @code{--no-init-path} |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
177 Don't initialize the search path for function files to include default |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
178 locations. |
3294 | 179 |
180 @item --no-line-editing | |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
181 @cindex @sortas{options, Octave command --no-line-editing} @ @ @code{--no-line-editing} |
3294 | 182 Disable command-line editing. |
183 | |
184 @item --no-site-file | |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
185 @cindex @sortas{options, Octave command --no-site-file} @ @ @code{--no-site-file} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
186 @cindex site startup file |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
187 Don't read the site-wide @file{octaverc} initialization files. |
3294 | 188 |
16774
8d188159ce5f
Add -W command line option to disable window system (bug #38937)
Rik <rik@octave.org>
parents:
16772
diff
changeset
|
189 @item --no-window-system |
8d188159ce5f
Add -W command line option to disable window system (bug #38937)
Rik <rik@octave.org>
parents:
16772
diff
changeset
|
190 @itemx -W |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
191 @cindex @sortas{options, Octave command --no-window-system} @ @ @code{--no-window-system} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
192 @cindex @sortas{options, Octave command -W} @ @ @code{-W} |
15540
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
193 Disable use of a windowing system including graphics. This forces a |
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
194 strictly terminal-only environment. |
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
195 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
196 @item --norc |
3294 | 197 @itemx -f |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
198 @cindex @sortas{options, Octave command --norc} @ @ @code{--norc} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
199 @cindex @sortas{options, Octave command -f} @ @ @code{-f} |
3294 | 200 Don't read any of the system or user initialization files at startup. |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
201 This is equivalent to using both of the options @option{--no-init-file} |
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
202 and @option{--no-site-file}. |
3294 | 203 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
204 @item --path @var{path} |
3294 | 205 @itemx -p @var{path} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
206 @cindex @sortas{options, Octave command --path} @ @ @code{--path @var{path}} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
207 @cindex @sortas{options, Octave command -p} @ @ @code{-p @var{path}} |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
208 Add path to the head of the search path for function files. The |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
209 value of @var{path} specified on the command line will override any value |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
210 of @w{@env{OCTAVE_PATH}} found in the environment, but not any commands in the |
6643 | 211 system or user startup files that set the internal load path through one |
212 of the path functions. | |
3294 | 213 |
5190 | 214 @item --persist |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
215 @cindex @sortas{options, Octave command --persist} @ @ @code{--persist} |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
216 Go to interactive mode after @option{--eval} or reading from a file |
5190 | 217 named on the command line. |
218 | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
219 @item --silent |
3294 | 220 @itemx --quiet |
221 @itemx -q | |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
222 @cindex @sortas{options, Octave command --silent} @ @ @code{--silent} |
25003
2365c2661b3c
doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
223 @cindex @sortas{options, Octave command --quiet} @ @ @code{--quiet} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
224 @cindex @sortas{options, Octave command -q} @ @ @code{-q} |
3294 | 225 Don't print the usual greeting and version message at startup. |
226 | |
15540
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
227 @item --texi-macros-file @var{filename} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
228 @cindex @sortas{options, Octave command --texi-macros-file} @ @ @code{--texi-macros-file @var{filename}} |
15540
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
229 Specify the name of the file containing Texinfo macros for use by makeinfo. |
d8e3111b1890
doc: Add documentation about new command-line options available.
Rik <rik@octave.org>
parents:
14856
diff
changeset
|
230 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
231 @item --traditional |
3294 | 232 @itemx --braindead |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
233 @cindex @sortas{options, Octave command --traditional} @ @ @code{--traditional} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
234 @cindex @sortas{options, Octave command --braindead} @ @ @code{--braindead} |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9035
diff
changeset
|
235 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
|
236 user preferences to the following values |
3294 | 237 |
238 @example | |
4455 | 239 @group |
10613
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
240 PS1 = ">> " |
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
241 PS2 = "" |
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
242 beep_on_error = true |
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
243 confirm_recursive_rmdir = false |
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
244 crash_dumps_octave_core = false |
29982
605275522c37
Deprecate disable_range, disable_diagonal_matrix, disable_permutation_matrix.
Rik <rik@octave.org>
parents:
29949
diff
changeset
|
245 optimize_diagonal_matrix = false |
605275522c37
Deprecate disable_range, disable_diagonal_matrix, disable_permutation_matrix.
Rik <rik@octave.org>
parents:
29949
diff
changeset
|
246 optimize_permutation_matrix = false |
605275522c37
Deprecate disable_range, disable_diagonal_matrix, disable_permutation_matrix.
Rik <rik@octave.org>
parents:
29949
diff
changeset
|
247 optimize_range = false |
10613
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
248 fixed_point_format = true |
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
249 history_timestamp_format_string = "%%-- %D %I:%M %p --%%" |
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
250 print_empty_dimensions = false |
29932
b39203a44db2
Call print_struct_array_contents(1) when '--traditional' option used.
Rik <rik@octave.org>
parents:
29668
diff
changeset
|
251 print_struct_array_contents = true |
19391
385499581a5e
allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents:
19274
diff
changeset
|
252 save_default_options = "-mat-binary" |
18154
5971c8f515a7
doc: Document options set when using --traditional.
Rik <rik@octave.org>
parents:
17793
diff
changeset
|
253 struct_levels_to_print = 0 |
6556 | 254 @end group |
255 @end example | |
256 | |
257 @noindent | |
258 and disable the following warnings | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
259 |
6556 | 260 @example |
261 @group | |
10613
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
262 Octave:abbreviated-property-match |
27517
85ad4689aa05
Add warning when non-scalar argument presented to ':' range operator.
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
263 Octave:colon-nonscalar-argument |
25179
3ae57b161ab4
doc: Document warning ID Octave:data-file-in-path (bug #53588)
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
264 Octave:data-file-in-path |
29932
b39203a44db2
Call print_struct_array_contents(1) when '--traditional' option used.
Rik <rik@octave.org>
parents:
29668
diff
changeset
|
265 Octave:empty-index |
7031 | 266 Octave:function-name-clash |
18154
5971c8f515a7
doc: Document options set when using --traditional.
Rik <rik@octave.org>
parents:
17793
diff
changeset
|
267 Octave:possible-matlab-short-circuit-operator |
4455 | 268 @end group |
3294 | 269 @end example |
270 | |
15618
9aa8dcf1e93d
doc: cross-reference Octave:matlab-incompatible to --braindead and --traditional
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15545
diff
changeset
|
271 @noindent |
19852
e9a0bd0b125c
Rename 'matlab-incompatible' warning to 'language-extension'.
Carnë Draug <carandraug@octave.org>
parents:
19697
diff
changeset
|
272 Note that this does not enable the @code{Octave:language-extension} |
15618
9aa8dcf1e93d
doc: cross-reference Octave:matlab-incompatible to --braindead and --traditional
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15545
diff
changeset
|
273 warning, which you might want if you want to be told about writing code |
17097
e7a059a9a644
doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents:
16880
diff
changeset
|
274 that works in Octave but not @sc{matlab} (@pxref{XREFwarning,,warning}, |
e7a059a9a644
doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents:
16880
diff
changeset
|
275 @ref{XREFwarning_ids,,warning_ids}). |
15618
9aa8dcf1e93d
doc: cross-reference Octave:matlab-incompatible to --braindead and --traditional
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15545
diff
changeset
|
276 |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
277 @item --verbose |
3294 | 278 @itemx -V |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
279 @cindex @sortas{options, Octave command --verbose} @ @ @code{--verbose} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
280 @cindex @sortas{options, Octave command -V} @ @ @code{-V} |
3294 | 281 Turn on verbose output. |
282 | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
283 @item --version |
3294 | 284 @itemx -v |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
285 @cindex @sortas{options, Octave command --version} @ @ @code{--version} |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
286 @cindex @sortas{options, Octave command -v} @ @ @code{-v} |
3294 | 287 Print the program version number and exit. |
288 | |
289 @item @var{file} | |
5190 | 290 Execute commands from @var{file}. Exit when done unless |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
291 @option{--persist} is also specified. |
3294 | 292 @end table |
293 | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
294 Octave also includes several functions which return information |
3294 | 295 about the command line, including the number of arguments and all of the |
296 options. | |
297 | |
3332 | 298 @DOCSTRING(argv) |
3294 | 299 |
6550 | 300 @DOCSTRING(program_name) |
301 | |
3332 | 302 @DOCSTRING(program_invocation_name) |
3294 | 303 |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
304 Here is an example of using these functions to reproduce the command |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
305 line which invoked Octave. |
3294 | 306 |
307 @example | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
308 @group |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
309 printf ("%s", program_name ()); |
6620 | 310 arg_list = argv (); |
3294 | 311 for i = 1:nargin |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
312 printf (" %s", arg_list@{i@}); |
3294 | 313 endfor |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
314 printf ("\n"); |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
315 @end group |
3294 | 316 @end example |
317 | |
318 @noindent | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
319 @xref{Indexing Cell Arrays}, for an explanation of how to retrieve objects |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
320 from cell arrays, and @ref{Defining Functions}, for information about the |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
321 variable @code{nargin}. |
3294 | 322 |
4167 | 323 @node Startup Files |
3294 | 324 @subsection Startup Files |
325 @cindex initialization | |
326 @cindex startup | |
327 | |
6620 | 328 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
|
329 the following list. These files may contain any valid Octave commands, |
6620 | 330 including function definitions. |
3294 | 331 |
332 @cindex startup files | |
333 | |
334 @table @code | |
335 @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
|
336 @cindex site startup file |
27832
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
337 where @code{@var{octave-home}} is the directory in which Octave is installed |
9906 | 338 (the default is @file{/usr/local}). |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
339 This file is provided so that changes to the default Octave environment |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
340 can be made globally for all users at your site for all versions of Octave |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
341 you have installed. Care should be taken when making changes to this file |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
342 since all users of Octave at your site will be affected. The default file |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
343 may be overridden by the environment variable @w{@env{OCTAVE_SITE_INITFILE}}. |
3294 | 344 |
345 @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
|
346 @cindex version startup file |
27832
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
347 where @code{@var{octave-home}} is the directory in which Octave is installed |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
348 (the default is @file{/usr/local}), and @code{@var{version}} is the version |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
349 number of Octave. This file is provided so that changes to the default |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
350 Octave environment can be made globally for all users of a particular version |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
351 of Octave. Care should be taken when making changes to this file since all |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
352 users of Octave at your site will be affected. The default file may be |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
353 overridden by the environment variable @w{@env{OCTAVE_VERSION_INITFILE}}. |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
354 |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
355 @item @var{config-dir}/octave/octaverc |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
356 @cindex personal startup file |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
357 where @code{@var{config-dir}} is the platform-dependent location for user |
27931
0fa21907e54c
doc: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents:
27838
diff
changeset
|
358 local configuration files (e.g., @w{@env{$XDG_CONFIG_HOME}} on many Unix-like |
27838
659acfaaf0c9
Use APPDATA for startup file location on Windows (bug #40444).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27832
diff
changeset
|
359 operating systems or @w{@env{%APPDATA%}} on Windows). |
3294 | 360 |
361 @item ~/.octaverc | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
362 @cindex personal startup file |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
363 @cindex @sortas{octaverc ~/.octaverc} @code{~/.octaverc} |
27832
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
364 This file is used to make personal changes to the default Octave environment. |
3294 | 365 |
366 @item .octaverc | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
367 @cindex project startup file |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
368 @cindex @sortas{octaverc .octaverc} @code{.octaverc} |
27832
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
369 This file can be used to make changes to the default Octave environment for a |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
370 particular project. Octave searches for this file in the current directory |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
371 after it reads @file{~/.octaverc}. Any use of the @code{cd} command in the |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
372 @file{~/.octaverc} file will affect the directory where Octave searches for |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
373 @file{.octaverc}. |
3294 | 374 |
8347
fa78cb8d8a5c
corrections for typos
Brian Gough<bjg@network-theory.co.uk>
parents:
8015
diff
changeset
|
375 If you start Octave in your home directory, commands from the file |
3294 | 376 @file{~/.octaverc} will only be executed once. |
21350
ea31a050bdd8
Execute commands in startup.m at start for compatibility with Matlab.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
377 |
ea31a050bdd8
Execute commands in startup.m at start for compatibility with Matlab.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
378 @item startup.m |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
379 @cindex @code{startup.m} |
27832
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
380 This file is used to make personal changes to the default Octave environment. |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
381 It is executed for @sc{matlab} compatibility, but @file{~/.octaverc} is the |
8fd7d1d2a4ca
Read startup files from XDG_CONFIG_HOME or LOCALAPPDATA (bug #36477).
Mike Miller <mtmiller@octave.org>
parents:
27517
diff
changeset
|
382 preferred location for configuration changes. |
3294 | 383 @end table |
384 | |
385 A message will be displayed as each of the startup files is read if you | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
386 invoke Octave with the @option{--verbose} option but without the |
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
387 @option{--silent} option. |
3294 | 388 |
28713
28d2511f2af2
maint: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents:
28652
diff
changeset
|
389 The startup files are always processed in the system's locale charset |
28d2511f2af2
maint: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents:
28652
diff
changeset
|
390 (independent of the m-file encoding that is set, for example, in the GUI |
28d2511f2af2
maint: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents:
28652
diff
changeset
|
391 properties). In other words, the system's locale charset is in effect until a |
28d2511f2af2
maint: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents:
28652
diff
changeset
|
392 user manually sets the m-file encoding (e.g., in one of the startup files) and |
28d2511f2af2
maint: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents:
28652
diff
changeset
|
393 triggers re-parsing of any relevant m-files. Octave can be forced to use a |
28d2511f2af2
maint: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents:
28652
diff
changeset
|
394 new encoding with the undocumented function @code{__mfile_encoding__}: |
28506
6bd9d77c7105
Document that startup files are interpreted in the locale charset (bug #57235).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27931
diff
changeset
|
395 |
6bd9d77c7105
Document that startup files are interpreted in the locale charset (bug #57235).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27931
diff
changeset
|
396 @example |
6bd9d77c7105
Document that startup files are interpreted in the locale charset (bug #57235).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27931
diff
changeset
|
397 @group |
6bd9d77c7105
Document that startup files are interpreted in the locale charset (bug #57235).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27931
diff
changeset
|
398 __mfile_encoding__ ("utf-8"); # set new encoding |
6bd9d77c7105
Document that startup files are interpreted in the locale charset (bug #57235).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27931
diff
changeset
|
399 clear ("functions"); # re-parse all .m files in the new encoding |
6bd9d77c7105
Document that startup files are interpreted in the locale charset (bug #57235).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27931
diff
changeset
|
400 @end group |
6bd9d77c7105
Document that startup files are interpreted in the locale charset (bug #57235).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27931
diff
changeset
|
401 @end example |
6bd9d77c7105
Document that startup files are interpreted in the locale charset (bug #57235).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27931
diff
changeset
|
402 |
28713
28d2511f2af2
maint: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents:
28652
diff
changeset
|
403 This changes the encoding that is used to interpret all subsequently run |
28d2511f2af2
maint: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents:
28652
diff
changeset
|
404 startup and m-files (not including the currently executing file). |
28506
6bd9d77c7105
Document that startup files are interpreted in the locale charset (bug #57235).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27931
diff
changeset
|
405 |
4167 | 406 @node Quitting Octave |
3294 | 407 @section Quitting Octave |
408 @cindex exiting octave | |
409 @cindex quitting octave | |
19273
dc64f1c4a33e
doc: Add documentation about finish.m and shutdown procedure to manual.
Rik <rik@octave.org>
parents:
18154
diff
changeset
|
410 @cindex finish.m |
dc64f1c4a33e
doc: Add documentation about finish.m and shutdown procedure to manual.
Rik <rik@octave.org>
parents:
18154
diff
changeset
|
411 @cindex site exiting file |
dc64f1c4a33e
doc: Add documentation about finish.m and shutdown procedure to manual.
Rik <rik@octave.org>
parents:
18154
diff
changeset
|
412 |
dc64f1c4a33e
doc: Add documentation about finish.m and shutdown procedure to manual.
Rik <rik@octave.org>
parents:
18154
diff
changeset
|
413 Shutdown is initiated with the @code{exit} or @code{quit} commands (they are |
dc64f1c4a33e
doc: Add documentation about finish.m and shutdown procedure to manual.
Rik <rik@octave.org>
parents:
18154
diff
changeset
|
414 equivalent). Similar to startup, Octave has a shutdown process that can be |
dc64f1c4a33e
doc: Add documentation about finish.m and shutdown procedure to manual.
Rik <rik@octave.org>
parents:
18154
diff
changeset
|
415 customized by user script files. During shutdown Octave will search for the |
dc64f1c4a33e
doc: Add documentation about finish.m and shutdown procedure to manual.
Rik <rik@octave.org>
parents:
18154
diff
changeset
|
416 script file @file{finish.m} in the function load path. Commands to save all |
dc64f1c4a33e
doc: Add documentation about finish.m and shutdown procedure to manual.
Rik <rik@octave.org>
parents:
18154
diff
changeset
|
417 workspace variables or cleanup temporary files may be placed there. Additional |
dc64f1c4a33e
doc: Add documentation about finish.m and shutdown procedure to manual.
Rik <rik@octave.org>
parents:
18154
diff
changeset
|
418 functions to execute on shutdown may be registered with @code{atexit}. |
3294 | 419 |
3332 | 420 @DOCSTRING(quit) |
3294 | 421 |
3332 | 422 @DOCSTRING(atexit) |
3294 | 423 |
4167 | 424 @node Getting Help |
3294 | 425 @section Commands for Getting Help |
15544
6a4e79110857
doc: Replace 'on-line' with modern 'online' in documentation and messages.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
426 @cindex online help |
6a4e79110857
doc: Replace 'on-line' with modern 'online' in documentation and messages.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
427 @cindex help, online |
3294 | 428 |
429 The entire text of this manual is available from the Octave prompt | |
6620 | 430 via the command @kbd{doc}. In addition, the documentation for |
3294 | 431 individual user-written functions and variables is also available via |
432 the @kbd{help} command. This section describes the commands used for | |
433 reading the manual and the documentation strings for user-supplied | |
434 functions and variables. @xref{Function Files}, for more information | |
435 about how to document the functions you write. | |
436 | |
3332 | 437 @DOCSTRING(help) |
3294 | 438 |
6549 | 439 @DOCSTRING(doc) |
440 | |
441 @DOCSTRING(lookfor) | |
442 | |
8817
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8347
diff
changeset
|
443 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
|
444 function. |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8347
diff
changeset
|
445 |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8347
diff
changeset
|
446 @DOCSTRING(news) |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8347
diff
changeset
|
447 |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8347
diff
changeset
|
448 @DOCSTRING(info) |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8347
diff
changeset
|
449 |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8347
diff
changeset
|
450 @DOCSTRING(warranty) |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8347
diff
changeset
|
451 |
9133
c0cef1436788
Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9132
diff
changeset
|
452 The following functions can be used to change which programs are used |
6620 | 453 for displaying the documentation, and where the documentation can be |
454 found. | |
3294 | 455 |
6477 | 456 @DOCSTRING(info_file) |
3294 | 457 |
6477 | 458 @DOCSTRING(info_program) |
3294 | 459 |
6477 | 460 @DOCSTRING(makeinfo_program) |
3686 | 461 |
14618
36f451642f79
doc: Add texi_macros_file to manual.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
462 @DOCSTRING(texi_macros_file) |
36f451642f79
doc: Add texi_macros_file to manual.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
463 |
9133
c0cef1436788
Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9132
diff
changeset
|
464 @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
|
465 |
16807
2fd22fbaffa3
doc: Add built_in_docstrings_file() to documentation.
Rik <rik@octave.org>
parents:
16774
diff
changeset
|
466 @DOCSTRING(built_in_docstrings_file) |
2fd22fbaffa3
doc: Add built_in_docstrings_file() to documentation.
Rik <rik@octave.org>
parents:
16774
diff
changeset
|
467 |
3332 | 468 @DOCSTRING(suppress_verbose_help_message) |
3294 | 469 |
12519
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
470 The following functions are principally used internally by Octave for |
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
471 generating the documentation. They are documented here for completeness |
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
472 and because they may occasionally be useful for users. |
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
473 |
16872
5372068bb148
Rename gen_doc_cache() to doc_cache_create().
Rik <rik@octave.org>
parents:
16816
diff
changeset
|
474 @DOCSTRING(doc_cache_create) |
12519
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
475 |
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
476 @DOCSTRING(get_help_text) |
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
477 |
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
478 @DOCSTRING(get_help_text_from_file) |
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
479 |
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
480 @DOCSTRING(get_first_help_sentence) |
91ccd08fe80c
Add gen_doc_cache, get_help_text, get_help_text_from_file, get_first_help_sentence to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
481 |
4167 | 482 @node Command Line Editing |
3294 | 483 @section Command Line Editing |
484 @cindex command-line editing | |
485 @cindex editing the command line | |
486 | |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
487 Octave uses the GNU Readline library to provide an extensive set of |
3294 | 488 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
|
489 features are described in this manual. In addition, all of the editing |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
490 functions can be bound to different key strokes at the user's discretion. |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
491 This manual assumes no changes from the default Emacs bindings. See the GNU |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
492 Readline Library manual for more information on customizing Readline and |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
493 for a complete feature list. |
3294 | 494 |
495 To insert printing characters (letters, digits, symbols, etc.), simply | |
496 type the character. Octave will insert the character at the cursor and | |
497 advance the cursor forward. | |
498 | |
499 Many of the command-line editing functions operate using control | |
500 characters. For example, the character @kbd{Control-a} moves the cursor | |
501 to the beginning of the line. To type @kbd{C-a}, hold down @key{CTRL} | |
502 and then press @key{a}. In the following sections, control characters | |
503 such as @kbd{Control-a} are written as @kbd{C-a}. | |
504 | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
505 Another set of command-line editing functions use Meta characters. To |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
506 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
|
507 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
|
508 even @key{WINDOWS}. If your terminal does not have a @key{META} key, you |
7001 | 509 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
|
510 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
|
511 @key{ESC} @key{u}. The @kbd{ESC} character sequences are also allowed on |
3294 | 512 terminals with real Meta keys. In the following sections, Meta |
513 characters such as @kbd{Meta-u} are written as @kbd{M-u}. | |
514 | |
3428 | 515 |
3294 | 516 @menu |
17152
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
517 * Cursor Motion:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
518 * Killing and Yanking:: |
22342
609403f90bb7
doc: Update Copyright and release date for manual.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
519 * Commands for Text:: |
609403f90bb7
doc: Update Copyright and release date for manual.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
520 * Commands for Completion:: |
609403f90bb7
doc: Update Copyright and release date for manual.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
521 * Commands for History:: |
17152
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
522 * Customizing readline:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
523 * Customizing the Prompt:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
524 * Diary and Echo Commands:: |
3294 | 525 @end menu |
526 | |
4167 | 527 @node Cursor Motion |
3294 | 528 @subsection Cursor Motion |
529 | |
530 The following commands allow you to position the cursor. | |
531 | |
532 @table @kbd | |
533 @item C-b | |
534 Move back one character. | |
535 | |
536 @item C-f | |
537 Move forward one character. | |
538 | |
11487
0f14c093476e
Add <BACKSPACE> documentation to cursor movement section.
Rik <octave@nomad.inbox5.com>
parents:
11486
diff
changeset
|
539 @item @key{BACKSPACE} |
0f14c093476e
Add <BACKSPACE> documentation to cursor movement section.
Rik <octave@nomad.inbox5.com>
parents:
11486
diff
changeset
|
540 Delete the character to the left of the cursor. |
0f14c093476e
Add <BACKSPACE> documentation to cursor movement section.
Rik <octave@nomad.inbox5.com>
parents:
11486
diff
changeset
|
541 |
3294 | 542 @item @key{DEL} |
11487
0f14c093476e
Add <BACKSPACE> documentation to cursor movement section.
Rik <octave@nomad.inbox5.com>
parents:
11486
diff
changeset
|
543 Delete the character underneath the cursor. |
3294 | 544 |
545 @item C-d | |
546 Delete the character underneath the cursor. | |
547 | |
548 @item M-f | |
549 Move forward a word. | |
550 | |
551 @item M-b | |
552 Move backward a word. | |
553 | |
554 @item C-a | |
555 Move to the start of the line. | |
556 | |
557 @item C-e | |
558 Move to the end of the line. | |
559 | |
560 @item C-l | |
561 Clear the screen, reprinting the current line at the top. | |
562 | |
17170
d6499c14021c
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
563 @item C-_ |
3294 | 564 @itemx C-/ |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
565 Undo the last action. You can undo all the way back to an empty line. |
3294 | 566 |
567 @item M-r | |
568 Undo all changes made to this line. This is like typing the `undo' | |
569 command enough times to get back to the beginning. | |
570 @end table | |
571 | |
572 The above table describes the most basic possible keystrokes that you need | |
573 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
|
574 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
|
575 to move forward and backward. |
3294 | 576 |
577 Notice how @kbd{C-f} moves forward a character, while @kbd{M-f} moves | |
578 forward a word. It is a loose convention that control keystrokes | |
579 operate on characters while meta keystrokes operate on words. | |
580 | |
581 @cindex clearing the screen | |
582 | |
6620 | 583 The function @code{clc} will allow you to clear the screen from within |
584 Octave programs. | |
585 | |
3332 | 586 @DOCSTRING(clc) |
3294 | 587 |
4167 | 588 @node Killing and Yanking |
3294 | 589 @subsection Killing and Yanking |
590 | |
591 @dfn{Killing} text means to delete the text from the line, but to save | |
592 it away for later use, usually by @dfn{yanking} it back into the line. | |
593 If the description for a command says that it `kills' text, then you can | |
594 be sure that you can get the text back in a different (or the same) | |
595 place later. | |
596 | |
597 Here is the list of commands for killing text. | |
598 | |
599 @table @kbd | |
600 @item C-k | |
601 Kill the text from the current cursor position to the end of the line. | |
602 | |
603 @item M-d | |
604 Kill from the cursor to the end of the current word, or if between | |
605 words, to the end of the next word. | |
606 | |
607 @item M-@key{DEL} | |
608 Kill from the cursor to the start of the previous word, or if between | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
609 words, to the start of the previous word. |
3294 | 610 |
611 @item C-w | |
612 Kill from the cursor to the previous whitespace. This is different than | |
613 @kbd{M-@key{DEL}} because the word boundaries differ. | |
614 @end table | |
615 | |
616 And, here is how to @dfn{yank} the text back into the line. Yanking | |
617 means to copy the most-recently-killed text from the kill buffer. | |
618 | |
619 @table @kbd | |
620 @item C-y | |
621 Yank the most recently killed text back into the buffer at the cursor. | |
622 | |
623 @item M-y | |
624 Rotate the kill-ring, and yank the new top. You can only do this if | |
625 the prior command is @kbd{C-y} or @kbd{M-y}. | |
626 @end table | |
627 | |
628 When you use a kill command, the text is saved in a @dfn{kill-ring}. | |
629 Any number of consecutive kills save all of the killed text together, so | |
630 that when you yank it back, you get it in one clean sweep. The kill | |
631 ring is not line specific; the text that you killed on a previously | |
632 typed line is available to be yanked back later, when you are typing | |
633 another line. | |
634 | |
22342
609403f90bb7
doc: Update Copyright and release date for manual.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
635 @node Commands for Text |
609403f90bb7
doc: Update Copyright and release date for manual.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
636 @subsection Commands for Changing Text |
3294 | 637 |
638 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
|
639 otherwise have a special meaning (e.g., @key{TAB}, @kbd{C-q}, etc.), or |
3294 | 640 for quickly correcting typing mistakes. |
641 | |
642 @table @kbd | |
17170
d6499c14021c
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
643 @item C-q |
3294 | 644 @itemx C-v |
645 Add the next character that you type to the line verbatim. This is | |
646 how to insert things like @kbd{C-q} for example. | |
647 | |
648 @item M-@key{TAB} | |
649 Insert a tab character. | |
650 | |
651 @item C-t | |
652 Drag the character before the cursor forward over the character at the | |
653 cursor, also moving the cursor forward. If the cursor is at the end of | |
654 the line, then transpose the two characters before it. | |
655 | |
656 @item M-t | |
657 Drag the word behind the cursor past the word in front of the cursor | |
658 moving the cursor over that word as well. | |
659 | |
660 @item M-u | |
661 Uppercase the characters following the cursor to the end of the current | |
662 (or following) word, moving the cursor to the end of the word. | |
663 | |
664 @item M-l | |
6620 | 665 Lowercase the characters following the cursor to the end of the current |
3294 | 666 (or following) word, moving the cursor to the end of the word. |
667 | |
668 @item M-c | |
669 Uppercase the character following the cursor (or the beginning of the | |
670 next word if the cursor is between words), moving the cursor to the end | |
671 of the word. | |
672 @end table | |
673 | |
22342
609403f90bb7
doc: Update Copyright and release date for manual.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
674 @node Commands for Completion |
609403f90bb7
doc: Update Copyright and release date for manual.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
675 @subsection Letting Readline Type for You |
3294 | 676 @cindex command completion |
677 | |
678 The following commands allow Octave to complete command and variable | |
679 names for you. | |
680 | |
681 @table @kbd | |
682 @item @key{TAB} | |
683 Attempt to do completion on the text before the cursor. Octave can | |
684 complete the names of commands and variables. | |
685 | |
686 @item M-? | |
687 List the possible completions of the text before the cursor. | |
688 @end table | |
689 | |
3332 | 690 @DOCSTRING(completion_append_char) |
3294 | 691 |
3332 | 692 @DOCSTRING(completion_matches) |
3294 | 693 |
22342
609403f90bb7
doc: Update Copyright and release date for manual.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
694 @node Commands for History |
609403f90bb7
doc: Update Copyright and release date for manual.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
695 @subsection Commands for Manipulating the History |
3294 | 696 @cindex command history |
697 @cindex input history | |
698 @cindex history of commands | |
699 | |
700 Octave normally keeps track of the commands you type so that you can | |
701 recall previous commands to edit or execute them again. When you exit | |
702 Octave, the most recent commands you have typed, up to the number | |
703 specified by the variable @code{history_size}, are saved in a file. | |
704 When Octave starts, it loads an initial list of commands from the file | |
705 named by the variable @code{history_file}. | |
706 | |
707 Here are the commands for simple browsing and searching the history | |
708 list. | |
709 | |
710 @table @kbd | |
17170
d6499c14021c
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
711 @item @key{LFD} |
3294 | 712 @itemx @key{RET} |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
713 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
|
714 non-empty, add it to the history list. If the line was a history |
3294 | 715 line, then restore the history line to its original state. |
716 | |
717 @item C-p | |
718 Move `up' through the history list. | |
719 | |
720 @item C-n | |
721 Move `down' through the history list. | |
722 | |
723 @item M-< | |
724 Move to the first line in the history. | |
725 | |
726 @item M-> | |
727 Move to the end of the input history, i.e., the line you are entering! | |
728 | |
729 @item C-r | |
730 Search backward starting at the current line and moving `up' through | |
731 the history as necessary. This is an incremental search. | |
732 | |
733 @item C-s | |
734 Search forward starting at the current line and moving `down' through | |
735 the history as necessary. | |
736 @end table | |
737 | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
738 On most terminals, you can also use the up and down arrow keys in place |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
739 of @kbd{C-p} and @kbd{C-n} to move through the history list. |
3294 | 740 |
741 In addition to the keyboard commands for moving through the history | |
742 list, Octave provides three functions for viewing, editing, and | |
743 re-running chunks of commands from the history list. | |
744 | |
3332 | 745 @DOCSTRING(history) |
3294 | 746 |
3332 | 747 @DOCSTRING(edit_history) |
3294 | 748 |
3332 | 749 @DOCSTRING(run_history) |
3294 | 750 |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
751 @noindent |
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
752 Octave also allows you customize the details of when, where, and how history |
6620 | 753 is saved. |
3294 | 754 |
16876
9e0618443c2b
Rename saving_history() to history_save().
Rik <rik@octave.org>
parents:
16875
diff
changeset
|
755 @DOCSTRING(history_save) |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
756 |
11486
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
757 @DOCSTRING(history_control) |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
758 |
3332 | 759 @DOCSTRING(history_file) |
3294 | 760 |
3332 | 761 @DOCSTRING(history_size) |
3294 | 762 |
6550 | 763 @DOCSTRING(history_timestamp_format_string) |
764 | |
6620 | 765 @DOCSTRING(EDITOR) |
766 | |
4167 | 767 @node Customizing readline |
3428 | 768 @subsection Customizing @code{readline} |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
769 @cindex @sortas{inputrc ~/.inputrc} @code{~/.inputrc} |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
770 @cindex customizing @code{readline} |
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
771 @cindex @code{readline} customization |
3428 | 772 |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
773 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
|
774 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
|
775 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
|
776 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
|
777 @file{~/.inputrc}. |
6620 | 778 |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9133
diff
changeset
|
779 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
|
780 the command line behavior. |
3428 | 781 |
16879
cc3743a91652
Rename read_readline_init_file to readline_read_init_file.
Rik <rik@octave.org>
parents:
16877
diff
changeset
|
782 @DOCSTRING(readline_read_init_file) |
3428 | 783 |
16880
1aebb613a5ac
Rename re_read_readline_init_file to readline_re_read_init_file.
Rik <rik@octave.org>
parents:
16879
diff
changeset
|
784 @DOCSTRING(readline_re_read_init_file) |
8817
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8347
diff
changeset
|
785 |
4167 | 786 @node Customizing the Prompt |
3294 | 787 @subsection Customizing the Prompt |
788 @cindex prompt customization | |
789 @cindex customizing the prompt | |
790 | |
791 The following variables are available for customizing the appearance of | |
792 the command-line prompts. Octave allows the prompt to be customized by | |
793 inserting a number of backslash-escaped special characters that are | |
794 decoded as follows: | |
795 | |
796 @table @samp | |
797 @item \t | |
798 The time. | |
799 | |
800 @item \d | |
801 The date. | |
802 | |
803 @item \n | |
804 Begins a new line by printing the equivalent of a carriage return | |
805 followed by a line feed. | |
806 | |
807 @item \s | |
808 The name of the program (usually just @samp{octave}). | |
809 | |
810 @item \w | |
811 The current working directory. | |
812 | |
813 @item \W | |
814 The basename of the current working directory. | |
815 | |
816 @item \u | |
817 The username of the current user. | |
818 | |
819 @item \h | |
820 The hostname, up to the first `.'. | |
821 | |
822 @item \H | |
823 The hostname. | |
824 | |
825 @item \# | |
826 The command number of this command, counting from when Octave starts. | |
827 | |
828 @item \! | |
829 The history number of this command. This differs from @samp{\#} by the | |
830 number of commands in the history list when Octave starts. | |
831 | |
832 @item \$ | |
833 If the effective UID is 0, a @samp{#}, otherwise a @samp{$}. | |
834 | |
835 @item \nnn | |
836 The character whose character code in octal is @var{nnn}. | |
837 | |
838 @item \\ | |
839 A backslash. | |
840 @end table | |
841 | |
3332 | 842 @DOCSTRING(PS1) |
3294 | 843 |
3332 | 844 @DOCSTRING(PS2) |
3294 | 845 |
3332 | 846 @DOCSTRING(PS4) |
3294 | 847 |
4167 | 848 @node Diary and Echo Commands |
3294 | 849 @subsection Diary and Echo Commands |
850 @cindex diary of commands and output | |
6939 | 851 @cindex command and output logs |
3294 | 852 @cindex logging commands and output |
853 @cindex echoing executing commands | |
854 @cindex command echoing | |
855 | |
856 Octave's diary feature allows you to keep a log of all or part of an | |
857 interactive session by recording the input you type and the output that | |
858 Octave produces in a separate file. | |
859 | |
3332 | 860 @DOCSTRING(diary) |
3294 | 861 |
862 Sometimes it is useful to see the commands in a function or script as | |
863 they are being evaluated. This can be especially helpful for debugging | |
864 some kinds of problems. | |
865 | |
3332 | 866 @DOCSTRING(echo) |
3294 | 867 |
4167 | 868 @node Errors |
3294 | 869 @section How Octave Reports Errors |
870 @cindex error messages | |
871 @cindex messages, error | |
872 | |
873 Octave reports two kinds of errors for invalid programs. | |
874 | |
875 A @dfn{parse error} occurs if Octave cannot understand something you | |
876 have typed. For example, if you misspell a keyword, | |
877 | |
878 @example | |
30321
2ba4758654ca
deprecate ** and .** operators (bug #60882)
John W. Eaton <jwe@octave.org>
parents:
29982
diff
changeset
|
879 octave:13> function z = f (x, y) z = x ||| 2; endfunction |
3294 | 880 @end example |
881 | |
882 @noindent | |
883 Octave will respond immediately with a message like this: | |
884 | |
885 @example | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
886 @group |
3294 | 887 parse error: |
888 | |
8015
30629059b72d
Update the manual to reflect the changes in error output
sh@sh-laptop
parents:
7031
diff
changeset
|
889 syntax error |
30629059b72d
Update the manual to reflect the changes in error output
sh@sh-laptop
parents:
7031
diff
changeset
|
890 |
30321
2ba4758654ca
deprecate ** and .** operators (bug #60882)
John W. Eaton <jwe@octave.org>
parents:
29982
diff
changeset
|
891 >>> function z = f (x, y) z = x ||| y; endfunction |
2ba4758654ca
deprecate ** and .** operators (bug #60882)
John W. Eaton <jwe@octave.org>
parents:
29982
diff
changeset
|
892 ^ |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
893 @end group |
3294 | 894 @end example |
895 | |
896 @noindent | |
897 For most parse errors, Octave uses a caret (@samp{^}) to mark the point | |
898 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
|
899 case, Octave generated an error message because the keyword for |
30321
2ba4758654ca
deprecate ** and .** operators (bug #60882)
John W. Eaton <jwe@octave.org>
parents:
29982
diff
changeset
|
900 the logical or operator (@code{||}) was misspelled. It marked the error |
2ba4758654ca
deprecate ** and .** operators (bug #60882)
John W. Eaton <jwe@octave.org>
parents:
29982
diff
changeset
|
901 at the third @samp{|} because the code leading up to this was correct |
2ba4758654ca
deprecate ** and .** operators (bug #60882)
John W. Eaton <jwe@octave.org>
parents:
29982
diff
changeset
|
902 but the final @samp{|} was not understood. |
3294 | 903 |
904 Another class of error message occurs at evaluation time. These | |
905 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
|
906 @dfn{evaluation errors}, because they occur when your program is being |
3294 | 907 @dfn{run}, or @dfn{evaluated}. For example, if after correcting the |
908 mistake in the previous function definition, you type | |
909 | |
910 @example | |
911 octave:13> f () | |
912 @end example | |
913 | |
914 @noindent | |
915 Octave will respond with | |
916 | |
9153
5247e89688e1
Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents:
9135
diff
changeset
|
917 @example |
3294 | 918 @group |
919 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
|
920 error: called from: |
30629059b72d
Update the manual to reflect the changes in error output
sh@sh-laptop
parents:
7031
diff
changeset
|
921 error: f at line 1, column 22 |
3294 | 922 @end group |
9153
5247e89688e1
Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents:
9135
diff
changeset
|
923 @end example |
3294 | 924 |
6620 | 925 @noindent |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
926 This error message has several parts, and gives quite a bit of |
3294 | 927 information to help you locate the source of the error. The messages |
928 are generated from the point of the innermost error, and provide a | |
929 traceback of enclosing expressions and function calls. | |
930 | |
931 In the example above, the first line indicates that a variable named | |
932 @samp{x} was found to be undefined near line 1 and column 24 of some | |
933 function or expression. For errors occurring within functions, lines | |
934 are counted from the beginning of the file containing the function | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
935 definition. For errors occurring outside of an enclosing function, |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
936 the line number indicates the input line number, which is usually displayed |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
937 in the primary prompt string. |
3294 | 938 |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
939 The second and third lines of the error message indicate that the error |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
940 occurred within the function @code{f}. If the function @code{f} had been |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
941 called from within another function, for example, @code{g}, the list of |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
942 errors would have ended with one more line: |
3294 | 943 |
944 @example | |
8015
30629059b72d
Update the manual to reflect the changes in error output
sh@sh-laptop
parents:
7031
diff
changeset
|
945 error: g at line 1, column 17 |
3294 | 946 @end example |
947 | |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
948 These lists of function calls make it fairly easy to trace the |
3294 | 949 path your program took before the error occurred, and to correct the |
950 error before trying again. | |
951 | |
4167 | 952 @node Executable Octave Programs |
3294 | 953 @section Executable Octave Programs |
954 @cindex executable scripts | |
955 @cindex scripts | |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
956 @cindex batch processing |
3294 | 957 @cindex self contained programs |
958 @cindex program, self contained | |
959 | |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
960 @opindex @code{#!} self-contained script |
3294 | 961 Once you have learned Octave, you may want to write self-contained |
962 Octave scripts, using the @samp{#!} script mechanism. You can do this | |
963 on GNU systems and on many Unix systems @footnote{The @samp{#!} | |
964 mechanism works on Unix systems derived from Berkeley Unix, System V | |
6481 | 965 Release 4, and some System V Release 3 systems.}. |
966 | |
967 Self-contained Octave scripts are useful when you want to write a | |
968 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
|
969 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
|
970 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
|
971 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
|
972 script and used again and again on new data files. |
3294 | 973 |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
974 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
|
975 text file named @file{hello}, containing the following lines: |
3294 | 976 |
977 @example | |
978 @group | |
979 #! @var{octave-interpreter-name} -qf | |
980 # a sample Octave program | |
981 printf ("Hello, world!\n"); | |
982 @end group | |
983 @end example | |
984 | |
985 @noindent | |
986 (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
|
987 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
|
988 @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
|
989 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
|
990 simply type: |
3294 | 991 |
992 @example | |
993 hello | |
994 @end example | |
995 | |
996 @noindent | |
997 at the shell, and the system will arrange to run Octave as if you had | |
998 typed: | |
999 | |
1000 @example | |
1001 octave hello | |
1002 @end example | |
1003 | |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
1004 The line beginning with @samp{#!} lists the full path and filename of an |
3294 | 1005 interpreter to be run, and an optional initial command line argument to |
1006 pass to that interpreter. The operating system then runs the | |
1007 interpreter with the given argument and the full argument list of the | |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
19852
diff
changeset
|
1008 executed program. The first argument in the list is the full filename |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
1009 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
|
1010 options to Octave, or data files, or both. The @samp{-qf} options are |
3294 | 1011 usually specified in stand-alone Octave programs to prevent them from |
1012 printing the normal startup message, and to keep them from behaving | |
1013 differently depending on the contents of a particular user's | |
6620 | 1014 @file{~/.octaverc} file. @xref{Invoking Octave from the Command Line}. |
6481 | 1015 |
1016 Note that some operating systems may place a limit on the number of | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1017 characters that are recognized after @samp{#!}. Also, the arguments |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1018 appearing in a @samp{#!} line are parsed differently by various |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1019 shells/systems. The majority of them group all the arguments together in one |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
1020 string and pass it to the interpreter as a single argument. In this case, the |
6481 | 1021 following script: |
1022 | |
1023 @example | |
1024 @group | |
1025 #! @var{octave-interpreter-name} -q -f # comment | |
1026 @end group | |
1027 @end example | |
1028 | |
1029 @noindent | |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
1030 is equivalent to typing at the command line: |
3294 | 1031 |
6481 | 1032 @example |
1033 @group | |
1034 octave "-q -f # comment" | |
1035 @end group | |
1036 @end example | |
3294 | 1037 |
6481 | 1038 @noindent |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
1039 which will produce an error message. Unfortunately, it is |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1040 not possible for Octave to determine whether it has been called from the |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
1041 command line or from a @samp{#!} script, so some care is needed when using the |
6481 | 1042 @samp{#!} mechanism. |
1043 | |
29508
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1044 @menu |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1045 * Passing Arguments to Executable Scripts:: |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1046 * Dual-Purpose Executable Scripts and Octave Functions:: |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1047 @end menu |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1048 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1049 @node Passing Arguments to Executable Scripts |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1050 @subsection Passing Arguments to Executable Scripts |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1051 |
6481 | 1052 Note that when Octave is started from an executable script, the built-in |
1053 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
|
1054 arguments passed to the executable Octave script, not the arguments |
6481 | 1055 passed to the Octave interpreter on the @samp{#!} line of the script. |
1056 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
|
1057 was used to execute the script, not @samp{-qf}. |
3294 | 1058 |
1059 @example | |
1060 @group | |
1061 #! /bin/octave -qf | |
6479 | 1062 printf ("%s", program_name ()); |
6620 | 1063 arg_list = argv (); |
3294 | 1064 for i = 1:nargin |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
1065 printf (" %s", arg_list@{i@}); |
3294 | 1066 endfor |
1067 printf ("\n"); | |
1068 @end group | |
1069 @end example | |
1070 | |
29508
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1071 @node Dual-Purpose Executable Scripts and Octave Functions |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1072 @subsection Dual-Purpose Executable Scripts and Octave Functions |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1073 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1074 To write m-files that can act as executable programs when called from the shell |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1075 or as normal functions when called from within Octave, use default input |
29668
f17b1f0141ed
doc: Grammarcheck documentation ahead of 6.3 release.
Rik <rik@octave.org>
parents:
29508
diff
changeset
|
1076 arguments initialized with the @code{argv} function. |
29508
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1077 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1078 If a function is called from the shell Octave will not pass any input |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1079 parameters to the function and therefore the default argument is used. But |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1080 when a function is called from the interpreter any arguments @emph{are} passed |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1081 to the function and these override the default. |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1082 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1083 Additionally, the file must end with the extension @file{.m} so that the |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1084 interpreter will recognize it as an Octave function. Finally, the output from |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1085 @code{argv} is a cell array of strings. It may be necessary to convert this |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1086 to a numeric value with @code{str2double} or @code{str2num} before processing. |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1087 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1088 As a complete example, consider the following code located in the file |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1089 @file{mysin.m}. |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1090 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1091 @example |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1092 @group |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1093 #! /bin/octave -qf |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1094 function retval = mysin (x = str2double (argv()@{end@})) |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1095 retval = sin (x) |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1096 endfunction |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1097 @end group |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1098 @end example |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1099 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1100 This can be called from the shell with |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1101 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1102 @example |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1103 mysin.m 1.5 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1104 @end example |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1105 |
29668
f17b1f0141ed
doc: Grammarcheck documentation ahead of 6.3 release.
Rik <rik@octave.org>
parents:
29508
diff
changeset
|
1106 @noindent |
29508
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1107 or from Octave with |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1108 |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1109 @example |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1110 mysin (1.5) |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1111 @end example |
7e987b69ebde
doc: Explain how to write dual-purpose executable scripts and Octave functions (bug #60291).
Rik <rik@octave.org>
parents:
28713
diff
changeset
|
1112 |
4167 | 1113 @node Comments |
3294 | 1114 @section Comments in Octave Programs |
1115 @cindex comments | |
1116 @cindex use of comments | |
1117 @cindex documenting Octave programs | |
1118 | |
1119 A @dfn{comment} is some text that is included in a program for the sake | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1120 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
|
1121 Comments can explain what the program does, and how it works. Nearly all |
3294 | 1122 programming languages have provisions for comments, because programs are |
1123 typically hard to understand without them. | |
1124 | |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1125 @menu |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1126 * Single Line Comments:: |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1127 * Block Comments:: |
17152
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
1128 * Comments and the Help System:: |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1129 @end menu |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1130 |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1131 @node Single Line Comments |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1132 @subsection Single Line Comments |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1133 |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
1134 @opindex @code{#} comment marker |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
1135 @opindex @code{%} comment marker |
3294 | 1136 In the Octave language, a comment starts with either the sharp sign |
1137 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
|
1138 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
|
1139 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
|
1140 shows whole line and partial line comments. |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
1141 |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1142 @example |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1143 @group |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1144 function countdown |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1145 # Count down for main rocket engines |
14856
c3fd61c59e9c
maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents:
14618
diff
changeset
|
1146 disp (3); |
c3fd61c59e9c
maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents:
14618
diff
changeset
|
1147 disp (2); |
c3fd61c59e9c
maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents:
14618
diff
changeset
|
1148 disp (1); |
c3fd61c59e9c
maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents:
14618
diff
changeset
|
1149 disp ("Blast Off!"); # Rocket leaves pad |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1150 endfunction |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1151 @end group |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1152 @end example |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1153 |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1154 @node Block Comments |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1155 @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
|
1156 @cindex block comments |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1157 @cindex multi-line comments |
3294 | 1158 |
24507
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
1159 @opindex @code{#@{} block comment marker |
dc25a0dc7800
Correct a host of small formatting issues with Texinfo manual (bug #52774)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
23723
diff
changeset
|
1160 @opindex @code{%@{} block comment marker |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1161 Entire blocks of code can be commented by enclosing the code between |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1162 matching @samp{#@{} and @samp{#@}} or @samp{%@{} and @samp{%@}} markers. |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1163 For example, |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
1164 |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1165 @example |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1166 @group |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1167 function quick_countdown |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1168 # Count down for main rocket engines |
14856
c3fd61c59e9c
maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents:
14618
diff
changeset
|
1169 disp (3); |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1170 #@{ |
14856
c3fd61c59e9c
maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents:
14618
diff
changeset
|
1171 disp (2); |
c3fd61c59e9c
maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents:
14618
diff
changeset
|
1172 disp (1); |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1173 #@} |
14856
c3fd61c59e9c
maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents:
14618
diff
changeset
|
1174 disp ("Blast Off!"); # Rocket leaves pad |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1175 endfunction |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1176 @end group |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1177 @end example |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1178 |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1179 @noindent |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17170
diff
changeset
|
1180 will produce a very quick countdown from @qcode{'3'} to @qcode{"Blast Off"} as |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17170
diff
changeset
|
1181 the 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
|
1182 |
12680
1acead61c527
doc: Document that block comment markers must appear alone on a line (bug #33297)
Rik <octave@nomad.inbox5.com>
parents:
12545
diff
changeset
|
1183 The block comment markers must appear alone as the only characters on a line |
14038
b0cdd60db5e5
doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents:
12691
diff
changeset
|
1184 (excepting whitespace) in order to be parsed correctly. |
12680
1acead61c527
doc: Document that block comment markers must appear alone on a line (bug #33297)
Rik <octave@nomad.inbox5.com>
parents:
12545
diff
changeset
|
1185 |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1186 @node Comments and the Help System |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1187 @subsection Comments and the Help System |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1188 @cindex documenting functions |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1189 @cindex documenting user scripts |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1190 @cindex help, user-defined functions |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1191 |
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1192 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
|
1193 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
|
1194 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
|
1195 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
|
1196 functions. For example, after defining the function @code{f} below, |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10613
diff
changeset
|
1197 |
3294 | 1198 @example |
1199 @group | |
1200 function xdot = f (x, t) | |
1201 | |
1202 # usage: f (x, t) | |
1203 # | |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1204 # This function defines the right-hand |
3294 | 1205 # side functions for a set of nonlinear |
1206 # differential equations. | |
1207 | |
1208 r = 0.25; | |
1209 @dots{} | |
1210 endfunction | |
1211 @end group | |
1212 @end example | |
1213 | |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10828
diff
changeset
|
1214 @noindent |
3294 | 1215 the command @kbd{help f} produces the output |
1216 | |
1217 @example | |
1218 @group | |
1219 usage: f (x, t) | |
1220 | |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1221 This function defines the right-hand |
3294 | 1222 side functions for a set of nonlinear |
1223 differential equations. | |
1224 @end group | |
1225 @end example | |
1226 | |
9135
b04f95fabbf9
Update sections 2.5, 2.6, 2.7 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9134
diff
changeset
|
1227 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
|
1228 throw-away Octave programs, it usually isn't very useful because the |
3294 | 1229 purpose of a comment is to help you or another person understand the |
1230 program at a later time. | |
1231 | |
9035
57649dcecb55
Documentation cleanup of basics.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
1232 The @code{help} parser currently only recognizes single line comments |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1233 (@pxref{Single Line Comments}) and not block comments for the initial |
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17793
diff
changeset
|
1234 help text. |