User`s guide

iii
3
Working with MEX-Files
A Simple Example — The Sierpinski Gasket . . . . . . . . . . . . . 3-2
Compiling the M-File into a MEX-File . . . . . . . . . . . . . . . . . . . . 3-3
Invoking the MEX-File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Compiler Options and Macros . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Generating Simulink S-Functions . . . . . . . . . . . . . . . . . . . . . . 3-7
Simulink Specific Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Specifying S-Function Characteristics . . . . . . . . . . . . . . . . . . . . 3-8
Converting Script M-Files to Function M-Files . . . . . . . . . . 3-10
4
Stand-Alone Applications
Differences Between MEX-Files
and Stand-Alone Applications . . . . . . . . . . . . . . . . . . . . . . . . .
4-2
Stand-Alone C Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Stand-Alone C++ Applications . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
Building Stand-Alone C/C++ Applications . . . . . . . . . . . . . . . 4-4
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Building Stand-Alone Applications on UNIX . . . . . . . . . . . . . 4-7
Configuring for C or C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Preparing to Compile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
Verifying mbuild . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
Verifying the MATLAB Compiler . . . . . . . . . . . . . . . . . . . . . . . 4-12
About the mbuild Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Packaging UNIX Applications . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13