User`s guide
3 Working with MEX-Files
3-4
This example uses the -x macro option to create the MEX-file. For more
information on this Compiler option, 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 the MATLAB interpreter the same
way you invoke the M-file version.
x = gasket(50000);
MATLAB runs the MEX-file version (gasket.mex, which is gasket.dll on the
PC) rather than the M-file version (
gasket.m). Given an M-file and a MEX-file
with the same root name (
gasket) in the same directory, the MEX-file takes
precedence.
Note To verify that the MEX-file version ran, use the which command
which gasket
D:\work\gasket.dll
To display the Sierpinski Gasket, use
imagesc(x); colormap([1 1 1;0 0 0]);
axis equal tight