
82 High Performance Programming for Soft Computing
where the meanings of the arguments of the mex function are described
in Table 3.1:
Table 3.1 Mex function arguments.
C/MEX Meaning M-code equivalent
Nhls Number of output variables nargout
Plhs Array of mxArray pointers to the output variables varagout
Nrhs Number of input variables nargin
Prhs Array of mxArray pointers to the input variables varagin
For our example, the mex function is called from MATLAB as follows:
Result=MatrixOperation(Matrix1,Matrix2)
where we have, nhls = 1 because Result is only one variable calculated
in the mex function, and plhs[0] is a pointer (type mxArray*) pointing to ...