- publishing free software manuals
GNU Octave Manual Version 3
by John W. Eaton, David Bateman, Søren Hauberg
Paperback (6"x9"), 568 pages
ISBN 095461206X
RRP £24.95 ($39.95)

Get a printed copy>>>

2.2 Quitting Octave

Built-in Function: exit (status)
Built-in Function: quit (status)
Exit the current Octave session. If the optional integer value status is supplied, pass that value to the operating system as the Octave's exit status. The default value is zero.

Built-in Function: atexit (fcn)
Register a function to be called when Octave exits. For example,

function bye_bye ()
  disp ("Bye bye");
endfunction
atexit ("bye_bye");

will print the message "Bye bye" when Octave exits.

Built-in Function: atexit (fcn, flag)
Register or unregister a function to be called when Octave exits, depending on flag. If flag is true, the function is registered, if flag is false, it is unregistered. For example, after registering the function bye_bye as above,

atexit ("bye_bye", false);

will remove the function from the list and Octave will not call the function bye_by when it exits.

Note that atexit only removes the first occurrence of a function from the list, so if a function was placed in the list multiple times with atexit, it must also be removed from the list multiple times.

ISBN 095461206XGNU Octave Manual Version 3See the print edition