Main Content

Customize Generated File Names

This example shows how to specify custom names for generated header and source files when you use compact file packaging.

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 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.

1. Open the ERT-based model DynamicIO. In the Configuration Parameters dialog box, change the System target file to ert.tlc.

open_system('DynamicIO')

2. On the Code Generation > Code Placement pane, select File packaging format as Compact(with separate date file).

3. 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

4. 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 sections.

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:

Related Topics