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. 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 Modular
or
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 ert.tlc
.
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:
Header files:
$R$E_header
Source files:
$R$E_source
Data
files: $R_data
$E
is mandatory for Header files
and Source files. $E
represents these instances of
file types:
capi
capi_host
dt
testinterface
private
types
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 private
and
types
. The generated header files resolve to the model name with the
value for $E
and custom text header
. The generated
source files resolve to the model name with custom text source
. The
generated data file resolves to the model name with custom text data
.
Here is a summary of naming rules applied and the corresponding generated files:
Type of File | Token Specification | Custom Text | Generated File Name |
---|---|---|---|
Header file | $R$E | header | rtwdemo_dynamicio_header.h |
Header file | $R$E | header | rtwdemo_dynamicio_private_header.h |
Source file | $R$E | source | rtwdemo_dynamicio_source.c |
Header file | $R$E | header | rtwdemo_dynamicio_types_header.h |
Data file | $R | data | rtwdemo_dynamicio_data.c |