Specify Templates For Code Generation
To use custom file processing features, create CGT files and CFP templates. These files are based on default templates provided by the code generation software. Once you have created your templates, you must integrate them into the code generation process.
Select and edit CGT files and CFP templates, and specify their use in the code generation process in the Code Generation > Templates pane of a model configuration set. The following figure shows options configured for their defaults.
The options related to custom file processing are:
The Source file (.c) template field in the Code templates and Data templates sections. This field specifies the name of a CGT file to use when generating source (
.c
or.cpp
) files. You must place this file on the MATLAB® path.The Header file (.h) template field in the Code templates and Data templates sections. This field specifies the name of a CGT file to use when generating header (
.h
) files. You must place this file on the MATLAB path.By default, the template for both source and header files is
.matlabroot
/toolbox/rtw/targets/ecoder/ert_code_template.cgtThe File customization template edit field in the Custom templates section. This field specifies the name of a CFP template file to use when generating code files. You must place this file on the MATLAB path. The default CFP template is
.matlabroot
/toolbox/rtw/targets/ecoder/example_file_process.tlc
In each of these fields, click Browse to navigate to and select an existing CFP template or CGT file. Click Edit to open the specified file into the MATLAB editor where you can customize it.