Main Content

Model Web View in Code Generation Report

Model Web Views

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.

Browser Requirements for Web Views

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:

  • Mozilla® Firefox® Version 1.5 or later, which has native support for SVG. To download the Firefox browser, go to https://www.mozilla.org/en-US/firefox/.

  • Apple Safari

  • Microsoft® Internet Explorer® that has Adobe® SVG Viewer plugin.

    Note

    Web views do not support Microsoft Internet Explorer 9.

Generate HTML Code Generation Report with Model Web View

This example shows how to create an HTML code generation report that includes a web view of the model diagram.

  1. Open the plcdemo_simple_subsystem model. To open the model, enter:

    openExample('plcdemo_simple_subsystem');

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

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

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

  5. To enable model web view, select the Report > Generate model web view check box.

  6. Click OK.

  7. 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.

  8. In the left navigation pane, select a source code file. The corresponding traceable source code is displayed in the right pane and includes hyperlinks.

  9. Click a hyperlink in the code. The model web view displays and highlights the corresponding block in the model.

  10. 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.

Model Web View Limitations

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.