Package: coder
codegen
configuration
object that specifies MEX function generation parameters
A coder.MexCodeConfig
object contains the
configuration parameters required by the codegen
function
to generate MEX functions. Use the -config
option
to pass the object to the codegen
function.
creates
a cfg
=coder.configcoder.MexCodeConfig
object for MEX function generation.
creates
a cfg
=coder.config('mex')coder.MexCodeConfig
object for MEX function generation.
|
For compile-time recursion, control the number of copies of
a function that are allowed in the generated code. To disallow recursion
in the MATLAB® code, set Default: | ||||||||||||
|
Specify, as a positive integer, the maximum number of instructions to be executed by the constant folder. Default: | ||||||||||||
|
Specify whether to include constant inputs in the MEX function signature. By default, ( If you specify If you specify Default: | ||||||||||||
|
Specify code to appear near the top of each C/C++ header file generated from your MATLAB algorithm code. Specify code as a character vector. Default: | ||||||||||||
|
Specify a space-separated list of include folders to add to the include path when compiling the generated code. Specify list of include folders as a character vector. If your list includes Windows® paths that contain spaces, enclose each instance in double quotes, for example: 'C:\Project "C:\Custom Files"' Default: | ||||||||||||
|
Specify code to appear in the initialize function of the generated Default: | ||||||||||||
|
Specify a space-separated list of static library files to link with the generated code. Specify list as a character vector. Default: | ||||||||||||
|
Specify a space-separated list of source files to compile and link with the generated code. Specify list of source files as a character vector. Default: | ||||||||||||
|
Specify code to appear near the top of the generated Default: | ||||||||||||
|
Specify code to appear in the terminate function of the generated Default: | ||||||||||||
|
Description of object, ,specified as a character vector. Default: | ||||||||||||
|
Control use of dynamic memory allocation for variable-size data. By default, dynamic memory allocation is enabled for variable-size
arrays whose size (in bytes) is greater than or equal to Set this property to Dependencies:
Default: | ||||||||||||
|
Specify the size threshold in bytes. Dependency:
Default: | ||||||||||||
|
Specify whether or not actions that do not terminate with a semicolon appear in the MATLAB Command Window. Default: | ||||||||||||
|
Specify whether MATLAB Coder™ treats common visualization
functions as extrinsic functions. When this option is enabled, MATLAB Coder detects
calls to many common visualization functions, such as Default: | ||||||||||||
|
Specify whether to use the debug option for the C compiler. If you enable debug mode, the C compiler does not optimize the code. The compilation is faster, but the execution is slower. Default: | ||||||||||||
|
Specify whether to use just-in-time (JIT) compilation for generation
of MEX functions. To speed up generation of MEX functions, set JIT compilation is incompatible with certain code generation
features and options, such as custom code or use of the OpenMP library.
If you specify JIT compilation and MATLAB Coder is unable to use
it, it generates a C/C++ MEX function with a warning. If Default: | ||||||||||||
|
Enable the
See memcpy Optimization. Default: | ||||||||||||
|
If possible, enable OpenMP. Using the OpenMP library, the MEX
function that MATLAB Coder generates for Use of the OpenMP library is not compatible with just-in-time
(JIT) compilation. If Default: | ||||||||||||
|
Allow recursive functions in generated code. If your MATLAB code
requires run-time recursion and this parameter is Some coding standards, such as MISRA®, do not allow recursion.
To increase the likelihood of generating code that is compliant with MISRA C®,
set Default: | ||||||||||||
|
Enable support for variable-size arrays. Dependency:
Default: | ||||||||||||
|
Allow calls to extrinsic functions. An extrinsic function is a function on the MATLAB path that MATLAB Coder dispatches to MATLAB software for execution. MATLAB Coder does not compile or generate code for extrinsic functions. When enabled ( When disabled (
If you disable extrinsic calls, the generated MEX function cannot
display run-time messages from Default: | ||||||||||||
|
Specify whether to generate one C/C++ file for each MATLAB language
file ( Default: | ||||||||||||
|
Control whether to compile the generated MEX function C/C++ code to produce a MEX function. Default: | ||||||||||||
|
Place comments in the generated files. Default: | ||||||||||||
|
Document generated code in a report. Default: | ||||||||||||
|
Controls synchronization of MEX function global data with the MATLAB global workspace. For constant global data, controls verification of consistency between the MEX function constant global data and the MATLAB global workspace.
Default: | ||||||||||||
|
Enable the
See memset Optimization. Default: | ||||||||||||
|
Specify the stack size limit on inlined functions. This specification determines the amount of stack space allocated for local variables of the inlined function. Specifying a limit on the stack space constrains the amount of inlining allowed. For out-of-line functions, stack space for variables local to the function is released when the function returns. However, for inlined functions, stack space remains occupied by the local variables even when the function returns. This feature is especially important for embedded processors, where stack size can be limited. Default: | ||||||||||||
|
Specify function size for inline threshold. Unless there are conflicts with other inlining conditions, MATLAB Coder inlines functions that are smaller than this size. The function size is measured in terms of an abstract number of instructions, not actual MATLAB instructions or instructions in the target processor. You must experiment with this parameter to obtain the inlining behavior that you want. For instance, if the default setting for this parameter is leading to large functions being inlined and in turn generating large C code, you can tune the parameter in steps until you are satisfied with the size of generated code. Default: | ||||||||||||
|
Specify the maximum size of functions after inlining. If the
size of the calling function after inlining exceeds The function size is measured in terms of an abstract number of instructions, not actual MATLAB instructions or instructions in the target processor. You must experiment with this parameter to obtain the inlining behavior that you want. For instance, if the default setting for this parameter is leading to large functions being inlined and in turn generating large C code, you can tune the parameter in steps until you are satisfied with the size of generated code. Default: | ||||||||||||
|
Detect violations of memory integrity in code generated for MATLAB functions and stops execution with a diagnostic message. Setting Default: | ||||||||||||
|
Specify whether to automatically display HTML reports after code generation is complete or an error occurs. Default: | ||||||||||||
|
Include MATLAB source code as comments in the generated code. Dependencies:
Default: | ||||||||||||
|
Specify the minimum number of bytes for the code generator to
invoke the The number of bytes is the number of array elements to copy or assign multiplied by the number of bytes required for the C/C++ data type. See memcpy Optimization and memset Optimization. Default: | ||||||||||||
|
Name of code generation configuration object, specified as a character vector. Default: | ||||||||||||
|
Specify command to customize build processing after MEX function
generation using Default: | ||||||||||||
|
Specify which variable names the code generator must preserve in the generated code.
Default: | ||||||||||||
|
Enter a list of names that MATLAB Coder is not to use for naming functions or variables. Specify list as a character vector. Default: | ||||||||||||
|
Enable responsiveness checks in code generated for MATLAB functions. These checks enable periodic checks for Ctrl+C breaks in the generated code. Enabling responsiveness checks also enables graphics refreshing.
Default: | ||||||||||||
|
Overflows saturate to either the minimum or maximum value that the data type can represent. Otherwise, the overflow behavior depends on your target C compiler. Most C compilers wrap on overflow. This parameter applies only to MATLAB built-in integer types. It does not apply to doubles, singles, or fixed-point data types. Default: | ||||||||||||
|
Specify the maximum stack usage per application in bytes. Set
a limit that is lower than the available stack size. Otherwise, a
runtime stack overflow might occur. Overflows are detected and reported
by the C compiler, not by Default: | ||||||||||||
|
Specify the target language. Set to Default: |
Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB documentation.
Generate a MEX function from a MATLAB function that is suitable for code generation and enable a code generation report.
Write a MATLAB function, coderand
,
that generates a random scalar value from the standard uniform distribution
on the open interval (0,1).
function r = coderand() %#codegen % The directive %#codegen declares that the function % is intended for code generation r = rand();
Create a code generation configuration object to generate a MEX function.
cfg = coder.config('mex')
Enable the code generation report.
cfg.GenerateReport = true;
Generate a MEX function in the current folder specifying
the configuration object using the -config
option.
% Generate a MEX function and code generation report codegen -config cfg coderand
Use the coder
function to create a MATLAB Coder project.
The project provides a user interface that facilitates adding MATLAB files,
defining input parameters, and specifying build parameters.