Generate Web View of Model in Code Generation Report - MATLAB & Simulink (original) (raw)

Main Content

To review and analyze the generated code, it is helpful to navigate between the code and model. If you have a Simulink® Report Generator™ license, 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. When you generate the report, the Web view includes the block diagram attributes displayed in the Simulink Editor, such as, block sorted execution order, signal properties, and port data types. You can display the generated Web views in a supported Web browser. See Web Views (Simulink Report Generator) for browser requirements and to read more about Web views.

Generate HTML Code Generation Report with Model Web View

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

  1. Open the TopModelCode model. At the command line, enter:
    openExample('simulinkcoder/FilePackagingModelsCodeAndDataExample', ...
    'supportingFile', 'TopModelCode');
  2. Open the Configuration Parameters dialog box and navigate to theCode Generation pane.
  3. Specify ert.tlc for the System target file parameter.
  4. Open the > pane.
  5. Select the following parameters:
    • Create code generation report
    • Open report automatically
    • Generate model Web view
  6. Select the parameters Code-to-model andModel-to-code.
    Note
    These settings specify only the top model, not referenced models.
  7. Open the Configuration Parameters for the referenced model,ReferenceModelCode and perform steps 3–6.
  8. Save the models, TopModelCode andReferenceModelCode.
  9. From the top model diagram, press Ctrl+B. After building the model and generating code, the code generation report for the top model opens in a MATLAB® Web browser.
  10. In the left navigation pane, select a source code file. The corresponding source code is displayed in the right pane and includes hyperlinks.
    Code generation report showing code for TopModelCode and a web view of the model.
  11. Click a link in the code. The model Web view displays and highlights the corresponding block in the model.
  12. To highlight the generated code for a Model block in your model, click CounterB. The corresponding code is highlighted in the source code pane.
    Note
    You cannot open the referenced model diagram in the Web view by double-clicking the Model block in the top model.
  13. To open the code generation report for a referenced model, at the top of the report, click TopModelCode. In the drop-down, clickReferenceModelCode. The source files for the referenced model are displayed along with the Web view of the referenced model.
  14. 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 top model’s report is displayed.

For more information about exploring a model in a Web view, see Create and Use Web Views of Models (Simulink Report Generator).

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

The HTML code generation report includes the following limitations when using the model Web view:

See Also

Topics