C/C++ code generation is the core functionality of MATLAB®
Coder™. Generate code from the app, which you can open with
coder, or from the command line, by
codegen function. The app provides
step-by-step guidance through the code generation process, including guidance around
best practices, and clear visual aids for the many code generation settings and
options. The command line workflow enables simple, repeatable, and efficient
initiation of code generation. The code generation workflow supports many different
data types, including variable-size data and global data. The workflow also supports
multiple entry-point (top-level) functions, and customization of fundamental
properties such as the array layout and array indexing of the generated code.
|Open MATLAB Coder app|
|Generate C/C++ code from MATLAB code|
|Determine if code generation target is specified target|
|Control code generation from protected MATLAB files|
|Create MATLAB Coder code generation configuration objects|
|Declare extrinsic functions|
|Call external C/C++ function|
|Include header file in generated code|
|Name C structure type in generated code|
|Declare variable in generated code|
|Indicate data to pass by reference|
|Indicate read-only data to pass by reference|
|Indicate write-only data to pass by reference|
Generate C/C++ code from MATLAB code.
Generate C/C++ code from MATLAB code by using the MATLAB Coder app.
Generate C/C++ code from MATLAB code by using the
Understand code generation considerations specific to C++.
Set up a project in the MATLAB Coder app.
codegen command with the
Generate code at the command line by using project settings.
Export project settings to a code generation configuration object or import the settings into a project.
Generate C/C++ code for multiple entry-point functions.
Simplify input type specification for multiple entry-point functions.
Generate C/C++ code with row elements stored contiguously in memory.
Preserve array dimensions in generated code.
Generate C++ code that is packaged into a class.