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

Arguments

For more information about arguments, see mexCallMATLAB.

nlhs

Number of desired output arguments.

plhs

Array of pointers to output arguments.

nrhs

Number of input arguments.

prhs

Array of pointers to input arguments.

functionName

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

Returns

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

Description

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 in R2008b