User`s guide
A MATLAB Compiler Quick Reference
A-2
Common Uses of the Compiler
This section summarizes how to use the MATLAB Compiler 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 into C and to create
the corresponding C MEX-file 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.
To translate an M-file named mymfile.m into C
and to create a stand-alone executable that can be run without MATLAB, use
mcc -m mymfile
Create a Stand-Alone C++ Application.
To translate an M-file named mymfile.m
into C++ and to create a stand-alone executable that can be run without
MATLAB, use
mcc -p mymfile
Create a Stand-Alone C Graphics Library Application.
To translate an M-file named
mymfile.m that contains Handle Graphics functions into C and to create a
stand-alone executable that can be run without MATLAB, use
mcc -B sgl mymfile
Create a Stand-Alone C++ Graphics Library Application.
To translate an M-file named
mymfile.m that contains Handle Graphics functions into C++ and to create a
stand-alone executable that can be run without MATLAB, 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