manpagez: man pages & more
info octave
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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)
Built-in Function: atexit (fcn, flag)

Register a function to be called when Octave exits. For example,

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

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

The additional argument flag will register or unregister fcn from the list of functions to be called when Octave exits. If flag is true, the function is registered, and if flag is false, it is unregistered. For example, after registering the function last_words above,

 
atexit ("last_words", false);

will remove the function from the list and Octave will not call last_words 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.


© manpagez.com 2000-2024
Individual documents may contain additional copyright information.