MATLAB Application Program Interface
  Go to function:
    Search    Help Desk 
mexAtExit    See Also

Register a subroutine to be called when the MEX-file is cleared or when MATLAB terminates

Fortran Syntax

Arguments

ExitFcn
  The exit function.

Returns

Always returns 0.

Description

Use mexAtExit to register a subroutine to be called just before the MEX-file is cleared or MATLAB is terminated. mexAtExit gives your MEX-file a chance to perform an orderly shutdown of anything under its control.

Each MEX-file can register only one active exit subroutine at a time. If you call mexAtExit more than once, MATLAB uses the ExitFcn from the more recent mexAtExit call as the exit function.

If a MEX-file is locked, all attempts to clear the MEX-file will fail. Consequently, if a user attempts to clear a locked MEX-file, MATLAB does not call the ExitFcn.

You must declare the ExitFcn as external in the Fortran routine that calls mexAtExit if it is not within the scope of the file.

See Also

mexSetTrapFlag



[ Previous | Help Desk | Next ]