For C code generation to a MEX file, MATLAB® provides a configuration object coder.MexConfig
for fine-tuning the compilation. To set MEX
compilation options:
Define the compiler configuration object in the MATLAB workspace by issuing a constructor command:
comp_cfg = coder.mexconfig
Modify the compilation options as necessary. See Compilation Options Modification at the Command Line Using Dot Notation
Invoke fiaccel
with the -config
option and
specify the configuration object as its
argument:
fiaccel -config comp_cfg myMfile
The -config
option instructs fiaccel
to
convert myFile.m
to a MEX function, based on the compilation
settings in comp_cfg
.
Use dot notation to modify the value of compilation options, using this syntax:
configuration_object.property = value
Dot notation uses assignment statements to modify configuration object properties. For example, to change the maximum size function to inline and the stack size limit for inlined functions during MEX generation, enter this code at the command line:
co_cfg = coder.mexconfig co_cfg.InlineThreshold = 25; co_cfg.InlineStackLimit = 4096; fiaccel -config co_cfg myFun
fiaccel
takes the union of all options, including those specified
using configuration objects, so that you can specify options in any order.