External Interfaces/API Reference |
MATLAB entry point to a Fortran MEX-file
Fortran Syntax
Arguments
nlhs
The number of expected outputs.
plhs
Array of pointers to expected outputs.
prhs
Array of pointers to input data. The input data is read only and should not be altered by your mexFunction
.
Description
mexFunction
is not a routine you call. Rather, mexFunction
is the name of a subroutine you must write in every MEX-file. When you invoke a MEX-file, MATLAB searches for a subroutine named mexFunction
inside the MEX-file. If it finds one, then the first executable line in mexFunction
becomes the starting point of the MEX-file. If MATLAB cannot find a subroutine named mexFunction
inside the MEX-file, MATLAB issues an error message.
When you invoke a MEX-file, MATLAB automatically loads nlhs
, plhs
, nrhs
, and prhs
with the caller's information. In the syntax of the MATLAB language, functions have the general form
where the ...
denotes more items of the same format. The a,b,c...
are left-hand side arguments and the d,e,f...
are right-hand side arguments. The arguments nlhs
and nrhs
contain the number of left-hand side and right-hand side arguments, respectively, with which the MEX-file is called. prhs
is an array of mxArray
pointers whose length is nrhs
. plhs
is a pointer to an array whose length is nlhs
, where your function must set pointers for the returned left-hand side mxArrays
.
mexEvalString | mexFunctionName |