User`s guide

A Simple Example - The Sierpinski Gasket
3-5
Note The timi n gs listed in this bo ok were recorded on a Pen tium Pro 200
MHz PC running Microsoft Windows NT. In each case, t he code was executed
two times and the result s of the second executi on wer e capture d for t his bo ok.
All of t he timings listed throughout t his book are for reference purposes only.
They are not absolute; if you execute the same example under the same
conditions, your times will probably diff er from these values. Us e these values
as a frame of reference only.
Compiling the M-File into a MEX-File
To create a MEX-file from this M-file, enter the mcc command at the MATLAB
interpreter prompt.
mcc -x gasket
This mcc command generates:
A file named
gasket.c containing MEX-file C source code.
A file named
gasket.h containing the public informatio n.
A file named
gasket_mex.c containing the MEX-function interface (MEX
wrapper).
AMEX-filenamed
gasket.mex. (The actual filename extension of the
executable MEX-file varies depending on your platform, e.g., on the PC the
file is named
gasket.dll.)
mcc automatically invokes mex to create gasket.mex from gasket.c and
gasket_mex.c.Themex utility encapsulates the appropriate C compiler and
linker options for your system.
This example uses the
-x macro option to create the MEX-file. For more
information on this Compiler option as well as the other options, see the
mcc
reference page. For more information on the files that the Compiler generates,
see Chapter 5, “Controlling Code Generation.
Invoking the MEX-File
Invoke the MEX-file version of gasket from theMATLABinterpreterthe same
wayyouinvoketheM-fileversion.