octave: Getting Help
2.3 Commands for Getting Help
=============================
The entire text of this manual is available from the Octave prompt via
the command ‘doc’. In addition, the documentation for individual
user-written functions and variables is also available via the ‘help’
command. This section describes the commands used for reading the
manual and the documentation strings for user-supplied functions and
variables. Function Files, for more information about how to
document the functions you write.
-- : help NAME
-- : help --list
-- : help .
-- : help
Display the help text for NAME.
For example, the command ‘help help’ prints a short message
describing the ‘help’ command.
Given the single argument ‘--list’, list all operators, keywords,
built-in functions, and loadable functions available in the current
session of Octave.
Given the single argument ‘.’, list all operators available in the
current session of Octave.
If invoked without any arguments, ‘help’ displays instructions on
how to access help from the command line.
The help command can provide information about most operators, but
NAME must be enclosed by single or double quotes to prevent the
Octave interpreter from acting on NAME. For example, ‘help "+"’
displays help on the addition operator.
DONTPRINTYET See also: doc XREFdoc, lookfor XREFlookfor, *noteDONTPRINTYET See also: doc XREFdoc, lookfor XREFlookfor,
which XREFwhich, info XREFinfo.
-- : doc FUNCTION_NAME
-- : doc
Display documentation for the function FUNCTION_NAME directly from
an online version of the printed manual, using the GNU Info
browser.
If invoked without an argument, the manual is shown from the
beginning.
For example, the command ‘doc rand’ starts the GNU Info browser at
the ‘rand’ node in the online version of the manual.
Once the GNU Info browser is running, help for using it is
available using the command ‘C-h’.
See also: help XREFhelp.
-- : lookfor STR
-- : lookfor -all STR
-- : [FCN, HELP1STR] = lookfor (STR)
-- : [FCN, HELP1STR] = lookfor ("-all", STR)
Search for the string STR in the documentation of all functions in
the current function search path.
By default, ‘lookfor’ looks for STR in just the first sentence of
the help string for each function found. The entire help text of
each function can be searched by using the "-all" argument. All
searches are case insensitive.
When called with no output arguments, ‘lookfor’ prints the list of
matching functions to the terminal. Otherwise, the output argument
FCNS contains the function names and HELP1STR contains the first
sentence from the help string of each function.
Programming Note: The ability of ‘lookfor’ to correctly identify
the first sentence of the help text is dependent on the format of
the function’s help. All Octave core functions are correctly
formatted, but the same can not be guaranteed for external packages
and user-supplied functions. Therefore, the use of the "-all"
argument may be necessary to find related functions that are not a
part of Octave.
The speed of lookup is greatly enhanced by having a cached
documentation file. See ‘doc_cache_create’ for more information.
DONTPRINTYET See also: help XREFhelp, doc XREFdoc, *notewhich:
DONTPRINTYET DONTPRINTYET See also: help XREFhelp, doc XREFdoc, which
XREFwhich, path XREFpath, *notedoc_cache_create:
DONTPRINTYET DONTPRINTYET See also: help XREFhelp, doc XREFdoc, which
XREFwhich, path XREFpath, doc_cache_create
XREFdoc_cache_create.
To see what is new in the current release of Octave, use the ‘news’
function.
-- : news
-- : news PACKAGE
Display the current NEWS file for Octave or an installed package.
When called without an argument, display the NEWS file for Octave.
When given a package name PACKAGE, display the current NEWS file
for that package.
See also: ver XREFver, pkg XREFpkg.
-- : info ()
Display contact information for the GNU Octave community.
-- : warranty ()
Describe the conditions for copying and distributing Octave.
The following functions can be used to change which programs are used
for displaying the documentation, and where the documentation can be
found.
-- : VAL = info_file ()
-- : OLD_VAL = info_file (NEW_VAL)
-- : info_file (NEW_VAL, "local")
Query or set the internal variable that specifies the name of the
Octave info file.
The default value is ‘OCTAVE-HOME/info/octave.info’, in which
OCTAVE-HOME is the root directory of the Octave installation. The
default value may be overridden by the environment variable
‘OCTAVE_INFO_FILE’, or the command line argument ‘--info-file
FNAME’.
When called from inside a function with the "local" option, the
variable is changed locally for the function and any subroutines it
calls. The original variable value is restored when exiting the
function.
See also: info_program XREFinfo_program, doc XREFdoc,
help XREFhelp, makeinfo_program XREFmakeinfo_program.
-- : VAL = info_program ()
-- : OLD_VAL = info_program (NEW_VAL)
-- : info_program (NEW_VAL, "local")
Query or set the internal variable that specifies the name of the
info program to run.
The default value is
‘OCTAVE-HOME/libexec/octave/VERSION/exec/ARCH/info’ in which
OCTAVE-HOME is the root directory of the Octave installation,
VERSION is the Octave version number, and ARCH is the system type
(for example, ‘i686-pc-linux-gnu’). The default value may be
overridden by the environment variable ‘OCTAVE_INFO_PROGRAM’, or
the command line argument ‘--info-program NAME’.
When called from inside a function with the "local" option, the
variable is changed locally for the function and any subroutines it
calls. The original variable value is restored when exiting the
function.
DONTPRINTYET See also: info_file XREFinfo_file, doc XREFdoc, *noteDONTPRINTYET See also: info_file XREFinfo_file, doc XREFdoc,
help XREFhelp, makeinfo_program XREFmakeinfo_program.
-- : VAL = makeinfo_program ()
-- : OLD_VAL = makeinfo_program (NEW_VAL)
-- : makeinfo_program (NEW_VAL, "local")
Query or set the internal variable that specifies the name of the
program that Octave runs to format help text containing Texinfo
markup commands.
The default value is ‘makeinfo’.
When called from inside a function with the "local" option, the
variable is changed locally for the function and any subroutines it
calls. The original variable value is restored when exiting the
function.
DONTPRINTYET See also: texi_macros_file XREFtexi_macros_file, *noteDONTPRINTYET See also: texi_macros_file XREFtexi_macros_file,
info_file XREFinfo_file, info_program XREFinfo_program,
doc XREFdoc, help XREFhelp.
-- : VAL = texi_macros_file ()
-- : OLD_VAL = texi_macros_file (NEW_VAL)
-- : texi_macros_file (NEW_VAL, "local")
Query or set the internal variable that specifies the name of the
file containing Texinfo macros that are prepended to documentation
strings before they are passed to makeinfo.
The default value is
‘OCTAVE-HOME/share/octave/VERSION/etc/macros.texi’, in which
OCTAVE-HOME is the root directory of the Octave installation, and
VERSION is the Octave version number. The default value may be
overridden by the environment variable ‘OCTAVE_TEXI_MACROS_FILE’,
or the command line argument ‘--texi-macros-file FNAME’.
When called from inside a function with the "local" option, the
variable is changed locally for the function and any subroutines it
calls. The original variable value is restored when exiting the
function.
See also: makeinfo_program XREFmakeinfo_program.
-- : VAL = doc_cache_file ()
-- : OLD_VAL = doc_cache_file (NEW_VAL)
-- : doc_cache_file (NEW_VAL, "local")
Query or set the internal variable that specifies the name of the
Octave documentation cache file.
A cache file significantly improves the performance of the
‘lookfor’ command. The default value is
‘OCTAVE-HOME/share/octave/VERSION/etc/doc-cache’, in which
OCTAVE-HOME is the root directory of the Octave installation, and
VERSION is the Octave version number. The default value may be
overridden by the environment variable ‘OCTAVE_DOC_CACHE_FILE’, or
the command line argument ‘--doc-cache-file FNAME’.
When called from inside a function with the "local" option, the
variable is changed locally for the function and any subroutines it
calls. The original variable value is restored when exiting the
function.
DONTPRINTYET See also: doc_cache_create XREFdoc_cache_create, *noteDONTPRINTYET DONTPRINTYET See also: doc_cache_create XREFdoc_cache_create,
lookfor XREFlookfor, info_program XREFinfo_program, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET See also: doc_cache_create XREFdoc_cache_create,
lookfor XREFlookfor, info_program XREFinfo_program,
doc XREFdoc, help XREFhelp, *notemakeinfo_program:
DONTPRINTYET DONTPRINTYET DONTPRINTYET See also: doc_cache_create XREFdoc_cache_create,
lookfor XREFlookfor, info_program XREFinfo_program,
doc XREFdoc, help XREFhelp, makeinfo_program
XREFmakeinfo_program.
See also: lookfor XREFlookfor.
-- : VAL = built_in_docstrings_file ()
-- : OLD_VAL = built_in_docstrings_file (NEW_VAL)
-- : built_in_docstrings_file (NEW_VAL, "local")
Query or set the internal variable that specifies the name of the
file containing docstrings for built-in Octave functions.
The default value is
‘OCTAVE-HOME/share/octave/VERSION/etc/built-in-docstrings’, in
which OCTAVE-HOME is the root directory of the Octave installation,
and VERSION is the Octave version number. The default value may be
overridden by the environment variable
‘OCTAVE_BUILT_IN_DOCSTRINGS_FILE’, or the command line argument
‘--built-in-docstrings-file FNAME’.
Note: This variable is only used when Octave is initializing
itself. Modifying it during a running session of Octave will have
no effect.
-- : VAL = suppress_verbose_help_message ()
-- : OLD_VAL = suppress_verbose_help_message (NEW_VAL)
-- : suppress_verbose_help_message (NEW_VAL, "local")
Query or set the internal variable that controls whether Octave
will add additional help information to the end of the output from
the ‘help’ command and usage messages for built-in commands.
When called from inside a function with the "local" option, the
variable is changed locally for the function and any subroutines it
calls. The original variable value is restored when exiting the
function.
The following functions are principally used internally by Octave for
generating the documentation. They are documented here for completeness
and because they may occasionally be useful for users.
-- : doc_cache_create (OUT_FILE, DIRECTORY)
-- : doc_cache_create (OUT_FILE)
-- : doc_cache_create ()
Generate documentation cache for all functions in DIRECTORY.
A documentation cache is generated for all functions in DIRECTORY
which may be a single string or a cell array of strings. The cache
is used to speed up the function ‘lookfor’.
The cache is saved in the file OUT_FILE which defaults to the value
‘doc-cache’ if not given.
If no directory is given (or it is the empty matrix), a cache for
built-in functions, operators, and keywords is generated.
DONTPRINTYET See also: doc_cache_file XREFdoc_cache_file, *notelookfor:
DONTPRINTYET See also: doc_cache_file XREFdoc_cache_file, lookfor
XREFlookfor, path XREFpath.
-- : [TEXT, FORMAT] = get_help_text (NAME)
Return the raw help text of function NAME.
The raw help text is returned in TEXT and the format in FORMAT The
format is a string which is one of "texinfo", "html", or "plain
text".
See also: get_help_text_from_file
XREFget_help_text_from_file.
-- : [TEXT, FORMAT] = get_help_text_from_file (FNAME)
Return the raw help text from the file FNAME.
The raw help text is returned in TEXT and the format in FORMAT The
format is a string which is one of "texinfo", "html", or "plain
text".
See also: get_help_text XREFget_help_text.
-- : TEXT = get_first_help_sentence (NAME)
-- : TEXT = get_first_help_sentence (NAME, MAX_LEN)
-- : [TEXT, STATUS] = get_first_help_sentence (...)
Return the first sentence of a function’s help text.
The first sentence is defined as the text after the function
declaration until either the first period (".") or the first
appearance of two consecutive newlines ("\n\n"). The text is
truncated to a maximum length of MAX_LEN, which defaults to 80.
The optional output argument STATUS returns the status reported by
‘makeinfo’. If only one output argument is requested, and STATUS
is nonzero, a warning is displayed.
As an example, the first sentence of this help text is
get_first_help_sentence ("get_first_help_sentence")
⊣ ans = Return the first sentence of a function's help text.