Getting Help - GNU Octave
Description: GNU Octave

Next: Command Line Editing, Previous: Quitting Octave, Up: Getting Started

### 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. See Function Files, for more information about how to document the functions you write.

— Command: help name
— Command: help `--list`

> 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.

> If invoked without any arguments, `help` display instructions on how to access help from the command line.

> The help command can give you information about operators, but not the comma and semicolons that are used as command separators. To get help for those, you must type `help comma` or `help semicolon`.

> See also: doc, lookfor, which.

— Command: doc function_name

> Display documentation for the function function_name directly from an on-line version of the printed manual, using the GNU Info browser. If invoked without any arguments, the manual is shown from the beginning.

> For example, the command `doc rand` starts the GNU Info browser at the `rand` node in the on-line 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.

— Command: lookfor str
— Command: lookfor -all str
— Function File: [func, helpstring] = lookfor (str)
— Function File: [func, helpstring] = lookfor ('-all', str)

> Search for the string str in all functions found in the current function search path. By default, `lookfor` searches for str in the first sentence of the help string of each function found. The entire help text of each function can be searched if the '-all' argument is supplied. All searches are case insensitive.

> Called with no output arguments, `lookfor` prints the list of matching functions to the terminal. Otherwise, the output arguments func and helpstring define the matching functions and the first sentence of each of their help strings.

> 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.

> See also: help, doc, which.

To see what is new in the current release of Octave, use the `news` function.

— Function File: news (package)

> Display the current NEWS file for Octave or installed package.

> If package is the name of an installed package, display the current NEWS file for that package.

— Function File: info ()

> Display contact information for the GNU Octave community.

— Built-in Function: 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.

— Built-in Function: val = info_file ()
— Built-in Function: old_val = info_file (new_val)
— Built-in Function: 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 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.

> See also: info_program, doc, help, makeinfo_program.

— Built-in Function: val = info_program ()
— Built-in Function: old_val = info_program (new_val)
— Built-in Function: 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.

> See also: info_file, doc, help, makeinfo_program.

— Built-in Function: val = makeinfo_program ()
— Built-in Function: old_val = makeinfo_program (new_val)
— Built-in Function: 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.

> See also: info_file, info_program, doc, help.

— Built-in Function: val = doc_cache_file ()
— Built-in Function: old_val = doc_cache_file (new_val)
— Built-in Function: 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 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.

> See also: lookfor, info_program, doc, help, makeinfo_program.

— Built-in Function: val = suppress_verbose_help_message ()
— Built-in Function: old_val = suppress_verbose_help_message (new_val)
— Built-in Function: 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.

— Function File: gen_doc_cache (out_file, directory)

> Generate documentation caches for all functions in a given directory.

> A documentation cache is generated for all functions in directory. The resulting cache is saved in the file out_file. The cache is used to speed up `lookfor`.

> If no directory is given (or it is the empty matrix), a cache for builtin operators, etc. is generated.

> See also: lookfor, path.

— Loadable Function: [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"`.

— Loadable Function: [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"`.

— Function File: [text, status] = get_first_help_sentence (name)
— Function File: [text, status] = get_first_help_sentence (name, max_len)

> 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 non-zero, 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.