To review and analyze the generated code, it is helpful to navigate between the code and model. You can include a web view of the model within the HTML code generation report. You can then share your model and generated code outside of the MATLAB® environment. You must have a Simulink® Report Generator™ license to include a Web view (Simulink Report Generator) of the model in the code generation report.
Web views require a web browser that supports Scalable Vector Graphics (SVG). Web views use SVG to render and navigate models.
You can use these web browsers:
Firefox® Version 1.5 or later, which has native support for SVG. To
download the Firefox browser, go to
Internet Explorer® that has Adobe® SVG Viewer plugin. To download the Adobe SVG Viewer plugin, go to
Web views do not support Microsoft Internet Explorer 9.
This example shows how to create an HTML code generation report that includes a web view of the model diagram.
Open the PLC Coder app. Click the PLC Code tab.
Click Settings and navigate to the Code Generation pane.
To enable report generation, select the Report>Generate traceability report check box.
To enable model web view, select the Report > Generate model web view check box.
On the PLC Code tab, click Generate PLC Code to initiate code and report generation. The code generation report for the top model opens in a MATLAB web browser.
In the left navigation pane, select a source code file. The corresponding traceable source code is displayed in the right pane and includes hyperlinks.
Click a hyperlink in the code. The model web view displays and highlights the corresponding block in the model.
To go back to the code generation report for the top model, at the top of the left navigation pane, click the Back button until the report for the top model is displayed.
For more information about navigating between the generated code and the model diagram, see Trace Simulink Model Elements in Generated Code.
When you are using the model web view, the HTML code generation report has these limitations:
Code is not generated for virtual blocks. In the model web view, if you click a virtual block, the code generation report clears highlighting in the source code files.
Stateflow® truth tables, events, and links to library charts are not supported.
Searching in the code generation report does not find or highlight text.
In a subsystem build, the traceability hyperlinks of the root-level inports and outports blocks are disabled.
If you navigate from the actual model diagram (not the model web view in the report), to the source code in the HTML code generation report, the model web view is disabled and not visible. To enable the model web view, open the report again, Open Code Generation Report (Simulink Coder).