User`s guide

A MATLAB Compiler Quick Reference
A-2
Common Uses of the Compiler
This section summarizes how t o use the MATLAB Comp iler to generate some
of its more standard results. The first four examples take advantage of the
macro options.
Create a MEX-File. To translate an M-file named mymfile.m in to C an d to create
the correspon ding C MEX-f ile that can be called directly from MATLAB, use
mcc -x mymfile
Create a Simulink S-Function. To translate an M-file named mymfile.m into C and
to create the corresponding Simulink S-function using dynamically sized
inputs and outputs, use
mcc -S mymfile
Create a Stand-Alone C Application. TotranslateanM-filenamedmymfile.m intoC
and to create a stand-alone ex ecutable that can be run without MATLAB, us e
mcc -m mymfile
Create a Stand-Alone C++ Application.
To translat e a n M-file named mymfile.m
into C++ and to create a stand-alo ne ex ec utab le that can be run wit hout
MATLAB , use
mcc -p mymfile
Create a Stand-Alone C Graphics Library Application. To trans lat e an M-file named
mymfile.m that contains Handle G raph ics functions into C and t o creat e a
stand-alone e x ecuta ble that can be run without M ATL AB, use
mcc -B sgl mymfile
Create a Stand-Alone C++ Graphics Library Application. To translat e an M -fi le named
mymfile.m that contains Handle G raph ics functions into C++ and to create a
stand-alone e x ecuta ble that can be run without M ATL AB, use
mcc -B sglcpp mymfile
Create a C Library.
To create a C library, use
mcc -m -W lib:libfoo -T link:lib foo.m