This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

mexCallMATLABWithTrap (C and Fortran)

Call MATLAB function, user-defined function, or MEX-file and capture error information

C Syntax

#include "mex.h"
mxArray *mexCallMATLABWithTrap(int nlhs, mxArray *plhs[], int nrhs,
   mxArray *prhs[], const char *functionName);

Fortran Syntax

#include "fintrf.h"
mwPointer mexCallMATLABWithTrap(nlhs, plhs, nrhs, prhs, functionName)
integer*4 nlhs, nrhs
mwPointer plhs(*), prhs(*)
character*(*) functionName


For more information about arguments, see mexCallMATLAB.


Number of desired output arguments.


Array of pointers to output arguments.


Number of input arguments.


Array of pointers to input arguments.


Character string containing the name of the MATLAB® built-in function, operator, function, or MEX-file that you are calling.


NULL if no error occurred; otherwise, a pointer to an mxArray of class MException.


The mexCallMATLABWithTrap function performs the same function as mexCallMATLAB. However, if MATLAB detects an error when executing functionName, MATLAB returns control to the line in the MEX-file immediately following the call to mexCallMATLABWithTrap. For information about MException, see Respond to an Exception

Introduced before R2006a

Was this topic helpful?