MATLAB Application Program Interface Reference Help Desk

mexCallMATLAB

Purpose

Call a MATLAB function, a user-defined M-file, or MEX-file

Fortran Syntax

On the Alpha and SGI64 platforms, use:

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 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, '+'.

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

mexFunction, mexSetTrapFlag



[ Previous | Help Desk | Next ]