| GNU Octave Manual by John W. Eaton Paperback (6"x9"), 324 pages, 4 figures ISBN 0954161726 RRP £19.99 ($29.99) |
1.3.5.1 A Sample Function Description
In a function description, the name of the function being described appears first. It is followed on the same line by a list of parameters. The names used for the parameters are also used in the body of the description.
Here is a description of an imaginary function foo:
- Function: foo (x, y, ...)
- The function
foosubtracts x from y, then adds the remaining arguments to the result. If y is not supplied, then the number 19 is used by default.foo (1, [3, 5], 3, 9) => [ 14, 16 ] foo (5) => 14More generally,
foo (w, x, y, ...) == x - w + y + ...
Any parameter whose name contains the name of a type (e.g., integer, integer1 or matrix) is expected to be of that type. Parameters named object may be of any type. Parameters with other sorts of names (e.g., new_file) are discussed specifically in the description of the function. In some sections, features common to parameters of several functions are described at the beginning.
Functions in Octave may be defined in several different ways. The catagory name for functions may include another name that indicates the way that the function is defined. These additional tags include
- Built-in Function
- The function described is written in a language like C++, C, or Fortran, and is part of the compiled Octave binary.
- Loadable Function
- The function described is written in a language like C++, C, or Fortran. On systems that support dynamic linking of user-supplied functions, it may be automatically linked while Octave is running, but only if it is needed. See section 11.8 Dynamically Linked Functions.
- Function File
- The function described is defined using Octave commands stored in a text file. See section 11.6 Function Files.
- Mapping Function
- The function described works element-by-element for matrix and vector arguments.
| ISBN 0954161726 | GNU Octave Manual | See the print edition |