Main Content

Create Code Generation Report

Generate a Traceability Report

Generate a Simulink® PLC Coder™ code generation report by using the Configuration Parameters dialog box:

  1. Verify that the model is open.

  2. Open the PLC Coder app. Click the PLC Code tab.

  3. Click Settings and navigate to the PLC Code Generation pane.

  4. To enable report generation, select the Report > Generate traceability report check box.

  5. To open the code generation report upon completion of code generation, select the Report> Open report automatically check box. Click OK.

  6. Click Generate PLC Code to initiate code and report generation. The coder generates HTML report files as part of the code generation process. THE HTML report opens.

  • The Traceability Report section enables you to account for Eliminated / Virtual Blocks that are untraceable, versus the listed Traceable Simulink Blocks / Stateflow Objects / MATLAB Scripts, providing a complete mapping between model elements and code.

  • The Static Code Metrics Report section provides generated code statistics. Metrics are estimated from static analysis of the generated code.

In the Generated Files section, you can click the names of source code files generated from your model to view their contents in a MATLAB® web browser window. In the displayed source code:

  • Global variable instances are hyperlinked to their definitions.

  • You can use the hyperlinks within the displayed source code to view the blocks or subsystems from which the code was generated. Click the hyperlinks to view the relevant blocks or subsystems in a Simulink model window.

  • You can view the generated code for a block in the model. To highlight a block's generated code in the HTML report, click the block and in the PLC Coder app, REVIEW RESULTS pane, click Navigate to Code.

For more information, see:


If you generate a code generation report for a model, and then change the model, the report becomes invalid. To keep your code generation report current, after modifying the source model, regenerate code and the report. If you close and then reopen a model, regenerate the report.