Configure Code Comments - MATLAB & Simulink (original) (raw)
Main Content
Configure how the code generator inserts comments into generated code by modifying parameters on the Code Generation > Comments pane.
Goal | Action |
---|---|
Include comments in generated code | Include comments. Selecting this parameter allows you to select one or more autogenerated comment types to be placed in the code. |
Include comments that describe a Simulink block's code | Simulink block comments. Selecting this parameter includes the comments before the Simulink® block’s code in the generated code. In Embedded Coder®, use Trace to model using (Embedded Coder) to select Block path or Simulink identifier as the comment format. |
Include comments that describe Stateflow objects | Stateflow object comments. Selecting this parameter includes the comments describing Stateflow® objects in the generated code. In Embedded Coder, use Trace to model using (Embedded Coder) to select Block path or Simulink identifier as the comment format. |
Include comments generated from block annotations | Connected annotations in block comments (Embedded Coder). Selecting this parameter includes the comments from Simulink block annotations in the generated code. |
Include MATLAB source code as comments | MATLAB source code as comments. Selecting this parameter inserts these comments preceding the associated generated code. The function signature is included in the function banner. |
Include comments for eliminated blocks | Show eliminated blocks. Selecting this parameter includes comments for blocks that were eliminated as the result of optimizations, such as inlining parameters. |
Include parameter comments regardless of the number of parameters | Verbose comments for 'Model default' storage class. Selecting this parameter includes comments for parameter variable names and names of source blocks in the model parameter structure declaration in_model__prm.h.If you do not select this parameter, parameter comments are generated if less than 1000 parameters are declared. This reduces the size of the generated file for models with a large number of parameters. |
Include MATLAB user comments | MATLAB user comments (Embedded Coder). Selecting this parameter includes function description comments and other user comments from MATLAB® code as comments in the generated code. |
Specify comment style | Comment style (Embedded Coder). Select Auto, Multi-line orSingle-line as the style of comments in the generated code. |
Note
When you configure the code generator to produce code that includes comments, the code generator includes text for model parameters, block names, signal names, and Stateflow object names in the generated code comments. If the text includes characters that are unrepresented in the character set encoding for the model, the code generator replaces the characters with XML escape sequences. For example, the code generator replaces the Japanese full-width Katakana letter ア with the escape sequence ア
. For more information, see Internationalization and Code Generation.
See Also
Topics
- Model Configuration Parameters: Comments (Embedded Coder)