MATLAB COMPILER RELEASE NOTES Guida Utente Pagina 133

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 132
Internal Interface Functions
5-17
F
Interface Function
The Com p ile r always generate s the F interface function, which contains the
“normal” C++ interface to the function. This code is the corresponding C++
interface function (
gasket) from the Sierpinski Gasket example. This function
calls the C++ code.
N
F
Interface Function
The Compiler produces this interface function only when the M -function uses
the variable
nargout.Thenargout interface allows the number of requested
outputstobespecifiedviathe
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
NF interface function (NFoo)forthefoo.m example
described earlier in this chapter. This function calls the
Mfoo function
appearing in
foo.cpp.
//
// The function "Nfoo" 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
//
// The function "gasket" 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.
//
mwArray gasket(mwArray numPoints) {
int nargout(1);
mwArray theImage(mclGetUninitializedArray());
theImage = Mgasket(nargout, numPoints);
return theImage;
}
Call M-function
Output argument
processing
Vedere la pagina 132
1 2 ... 128 129 130 131 132 133 134 135 136 137 138 ... 263 264

Commenti su questo manuale

Nessun commento