Navigation

Operators and Keywords

Function List:

C++ API

: edit_history
: edit_history cmd_number
: edit_history first last

Edit the history list using the editor named by the variable EDITOR.

The commands to be edited are first copied to a temporary file. When you exit the editor, Octave executes the commands that remain in the file. It is often more convenient to use edit_history to define functions rather than attempting to enter them directly on the command line. The block of commands is executed as soon as you exit the editor. To avoid executing any commands, simply delete all the lines from the buffer before leaving the editor.

When invoked with no arguments, edit the previously executed command; With one argument, edit the specified command cmd_number; With two arguments, edit the list of commands between first and last. Command number specifiers may also be negative where -1 refers to the most recently executed command. The following are equivalent and edit the most recently executed command.

edit_history
edit_history -1

When using ranges, specifying a larger number for the first command than the last command reverses the list of commands before they are placed in the buffer to be edited.

See also: run_history, history.

Package: octave