How can I avoid having information on date and time of file creation when generating code from a Simulink model?

Each time I generate C code from a Simulink model, date and time are inserted by the coder in all the generated files.
How can I avoid this?

 Accepted Answer

With an Embedded Coder or Simulink Coder license, by choosing the 'ert.tlc' system target file, it is indeed possible to do so.
In so doing, you would need to create your custom CGT file and use it in the 'Code templates' and 'Data templates' sections of Code Generation > Templates in the Configuration Parameters of the model.
In this case, in order to avoid generating date and time of the file creation, you would need to remove the following token for the file banner generation:
%<SourceGeneratedOn>
Therefore, your CGT file should be similar to 'ert_code_template.cgt', though with a slightly modified section:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Custom file banner section (optional)
%%
<FileBanner style="classic">
File: %<FileName>
 
Code generated for Simulink model '%<ModelName>'.
Model version                  : %<ModelVersion>
Simulink Coder version         : %<RTWFileVersion>
%<CodeGenSettings>
</FileBanner>
For further information, please refer to the following links:

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!