The code generator creates
model.* files during
the code generation and build process. When you generate C/C++ code for ERT-based models, you
can customize the names of the generated header, source, and data files. You cannot customize
the generated files for referenced models. Custom file names enable you to:
Comply with naming standards of the company or industry.
Integrate with external code.
In the Configuration Parameters dialog box, on the Code Generation > Code Placement pane, use the Auto-generated file naming rules group to
customize the names of generated files. When you use
Compact(with separate date file) file packaging, you can specify
custom names for generated header, source, and data files. When you use
Compact file packaging, you can specify custom names for
generated header and source files.
Open any ERT-based model, for example,
rtwdemo_dynamicio. In the Configuration Parameters dialog box, change
the System target file to
On the Code Generation > Code Placement pane, select File packaging format as
Compact(with separate date file).
Specify custom file names by using the naming rules for these parameters:
$E is mandatory for Header files
and Source files.
$E represents these instances of
To build the model, press Ctrl + B. In the code generation report, the generated files are listed on the left pane under Model files and Data files section.
In this example,
$E resolves to
types. The generated header files resolve to the model name with the
$E and custom text
header. The generated
source files resolve to the model name with custom text
generated data file resolves to the model name with custom text
Here is a summary of naming rules applied and the corresponding generated files:
|Type of File||Token Specification||Custom Text||Generated File Name|