Matlab C Library Call Matlab Built-In Functions

原文:http://note.sonots.com/Mex/Builtin.html

Syntax 

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

Arguments 

nlhs
Number of desired output arguments. This value must be less than or equal to 50.
plhs
Array of pointers to mxArrays. The called command puts pointers to the resultant mxArrays into plhs and allocates dynamic memory to store the resultant mxArrays. By default, MATLAB automatically deallocates this dynamic memory when you clear the MEX-file. However, if heap space is at a premium, you may want to call mxDestroyArray as soon as you are finished with the mxArrays that plhs points to.
nrhs
Number of input arguments. This value must be less than or equal to 50.
prhs
Array of pointers to input arguments.
name
Character string 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.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章