| MATLAB Application Program Interface | Search  Help Desk |
| mexCallMATLAB | See Also |
Call a MATLAB function, a user-defined M-file, or MEX-file
integer*4 function mexCallMATLAB(nlhs, plhs, nrhs, prhs, name) integer*4 nlhs, nrhs, plhs(*), prhs(*) character*(*) nameOn the Alpha and SGI64 platforms, use:
integer*8 function mexCallMATLAB(nlhs, plhs, nrhs, prhs, name) integer*4 nlhs, nrhs integer*8 plhs(*), prhs(*) character*(*) namenlhs
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
Character array containing the name of the MATLAB built-in, operator, M-file, or MEX-file that you are calling. If name is an operator, just place the operator inside a pair of single quotes; for example, '+'.
0 if successful, and a nonzero value if unsuccessful and mexSetTrapFlag was previously called.
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.
mexFunction, mexSetTrapFlag