External Interfaces Reference |
Call MATLAB function or operator, user-defined M-file, or other MEX-file
Fortran Syntax
integer*4 function mexCallMATLAB(nlhs, plhs, nrhs, prhs, name) integer*4 nlhs, nrhs, plhs(*), prhs(*) character*(*) name
Arguments
nlhs
Number of desired output arguments. This value must be less than or equal to 50.
plhs
Array of mxArray
pointers that can be used to access the returned data from the function call. Once the data is accessed, you can then call mxFree
to free the mxArray
pointer. By default, MATLAB frees the pointer and any associated dynamic memory it allocates when you return from the mexFunction
call.
nrhs
Number of input arguments. This value must be less than or equal to 50.
prhs
Array of pointers to input data.
name
Character
array containing the name of the MATLAB function, operator, M-file, or MEX-file that you are calling. If name
is an operator, place the operator inside a pair of single quotes; for example, '+'
.
Returns
0 if successful, and a nonzero value if unsuccessful and mexSetTrapFlag
was previously called.
Description
Call mexCallMATLAB
to invoke internal MATLAB functions, MATLAB operators, M-files, or other MEX-files.
By default, if name
detects an error, MATLAB terminates the MEX-file and returns control to the MATLAB prompt. If you want a different error behavior, turn on the trap flag by calling mexSetTrapFlag
.
See Also
mexAtExit | mexErrMsgIdAndTxt |
© 1994-2005 The MathWorks, Inc.