User`s guide

Internal Interface Functions
5-13
mlfN
F
Interface Function
The Compiler produces this interface function only when the M-function uses
the variable
nargout.The nargout interface allows you to specify the number
of requested outputs via the int
nargout argument, as opposed to the normal
interface that dynamically calculates the number of outputs based on the
number of non-null inputs it receives.
This is the corresponding
mlfNF interface function (mlfNFoo)forthefoo.m
example described earlier in this chapter. This function calls the Mfoo functi on
that appears in
foo.c.
/*
* The function "mlfNFoo" contains the nargout interface
* for the "foo" M-function from file
* "<matlab>\extern\examples\compiler\foo.m" (lines 1-8).
* This interface is only produced if the M-function uses
* the special variable "nargout". The nargout interface
* allows the number of requested outputs to be specified
* via the nargout argument, as opposed to the normal
* interface which dynamically calculates the number of
/*
* The function "mlfGasket" contains the normal interface
* for the "gasket" M-function from file
* "<matlab>\extern\examples\compiler\gasket.m" (lines 1-23).
* This function processes any input arguments and passes
* them to the implementation version of the function,
* appearing above.
*/
mxArray * mlfGasket(mxArray * numPoints) {
int nargout = 1;
mxArray * theImage = mclGetUninitializedArray();
mlfEnterNewContext(0, 1, numPoints);
theImage = Mgasket(nargout, numPoints);
mlfRestorePreviousContext(0, 1, numPoints);
return mlfReturnValue(theImage);
}
Input argument
processing
Output argument
processing
Call M-function