MATLAB Compiler    

Using Pragmas

Using feval

In stand-alone C and C++ modes, the pragma

informs the MATLAB Compiler that the specified function(s) will be called through an feval call or through a MATLAB function that accepts a function to feval as an argument or contains an eval string or Handle Graphics callback that references the specified function. Without this pragma, the -h option will not be able to locate and compile all M-files used in your application.

If you are using the %#function pragma to define functions that are not available in M-code, you must write a dummy M-function that identifies the number of input and output parameters to the M-file function with the same name used on the %#function line. For example:

This implies that myfunctionwritteninc is an M-function that will be called using feval. The Compiler will look up this function to determine the correct number of input and output variables.

Compiling MEX-Files

If the Compiler finds both a function M-file and a .mex file in the same directory, it will assume that the .mex file is the compiled version of the M-file. In those cases, if the M-file version is not desired, use the %#mex pragma to force the Compiler to use the MEX-file. For example:


  C Example Optimizing Performance