| GNU Octave Manual by John W. Eaton Paperback (6"x9"), 324 pages, 4 figures ISBN 0954161726 RRP £19.99 ($29.99) |
7.2 Status of Variables
- Command: clear options pattern ...
- Delete the names matching the given patterns from the symbol table. The
pattern may contain the following special characters:
?- Match any single character.
*- Match zero or more characters.
[ list ]-
Match the list of characters specified by list. If the first
character is
!or^, match all characters except those specified by list. For example, the pattern ‘[a-zA-Z]’ will match all lower and upper case alphabetic characters.
For example, the command
clear foo b*r
clears the name
fooand all names that begin with the letterband end with the letterr.If
clearis called without any arguments, all user-defined variables (local and global) are cleared from the symbol table. Ifclearis called with at least one argument, only the visible names matching the arguments are cleared. For example, suppose you have defined a functionfoo, and then hidden it by performing the assignmentfoo = 2. Executing the command clear foo once will clear the variable definition and restore the definition offooas a function. Executing clear foo a second time will clear the function definition.This command may not be used within a function body.
- Command: who options pattern ...
- Command: whos options pattern ...
- List currently defined symbols matching the given patterns. The
following are valid options. They may be shortened to one character but
may not be combined.
-all- List all currently defined symbols.
-builtins-
List built-in variables and functions. This includes all currently
compiled function files, but does not include all function files that
are in the
LOADPATH. -functions- List user-defined functions.
-long- Print a long listing including the type and dimensions of any symbols. The symbols in the first column of output indicate whether it is possible to redefine the symbol, and whether it is possible for it to be cleared.
-variables- List user-defined variables.
Valid patterns are the same as described for the
clearcommand above. If no patterns are supplied, all symbols from the given category are listed. By default, only user defined functions and variables visible in the local scope are displayed.The command whos is equivalent to who -long.
- Built-in Function: exist (name)
- Return 1 if the name exists as a variable, 2 if the name (after appending ‘.m’) is a function file in the path, 3 if the name is a ‘.oct’ file in the path, or 5 if the name is a built-in function. Otherwise, return 0.
- Built-in Function: document (symbol, text)
- Set the documentation string for symbol to text.
- Command: type options name ...
- Display the definition of each name that refers to a function.
Normally also displays if each name is user-defined or builtin; the
-qoption suppresses this behaviour.Currently, Octave can only display functions that can be compiled cleanly, because it uses its internal representation of the function to recreate the program text.
Comments are not displayed because Octave's parser currently discards them as it converts the text of a function file to its internal representation. This problem may be fixed in a future release.
- Command: which name ...
- Display the type of each name. If name is defined from a function file, the full name of the file is also displayed.
| ISBN 0954161726 | GNU Octave Manual | See the print edition |