Next: Organization of Functions, Previous: Function Handles Inline Functions and Anonymous Functions, Up: Functions and Scripts
Commands are a special class of functions that only accept string input arguments. A command can be called as an ordinary function, but it can also be called without the parentheses like the following example shows
my_command hello world
which is the same as
my_command("hello", "world")
The general form of a command call is
name arg1 arg2 ...
which translates directly to
name ("arg1", "arg2", ...)
A function can be used as a command if it accepts string input arguments.
To do this, the function must be marked as a command, which can be done
with the mark_as_command
command like this
mark_as_command name
where name
is the function to be marked as a command.
One difficulty of commands occurs when one of the string input arguments are stored in a variable. Since Octave can't tell the difference between a variable name, and an ordinary string, it is not possible to pass a variable as input to a command. In such a situation a command must be called as a function.
This function is obsolete and will be removed from a future version of Octave.
This function is obsolete and will be removed from a future version of Octave.
This function is obsolete and will be removed from a future version of Octave.
This function is obsolete and will be removed from a future version of Octave.