Main Content

Generate Web View of Model in Code Generation Report

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. From Simulink Toolstrip, open the HDL Coder app.

  2. Open the RunningSum model. At the command line, enter:

    openExample('hdlcoder/GenerateRecordTypesForBusSignalsAtSubsystemInterfaceExample',...
    'supportingFile','BusSignalWithRecordTypes');

  3. Open the Configuration Parameters dialog box and navigate to the HDL Code Generation > Report pane.

  4. Configure these parameters:

    • Select Generate traceability report.

    • Set Traceability style to Comment Based.

    • Select Generate model Web view.

  5. Click Apply and save the model.

  6. In the HDL Code tab, click the Generate HDL Code button.

    After building the model and generating code, the code generation report opens in a MATLAB® Web browser.

  7. In the left navigation pane, select a source code file. The corresponding source code is displayed in the right pane and includes hyperlinked comments.

    Code generation report showing code for the DUT subsystem and a web view of the model.

  8. Click a link in the code. The model Web view displays and highlights the corresponding block in the model.

  9. To highlight the generated code for a block in your model, click the block. The corresponding code is highlighted in the source code pane.

For more information about exploring a model in a Web view, see Explore Web Views (Simulink Report Generator).

Model Web View Limitations

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

  • Code is not generated for virtual blocks. In the model Web view of the code generation report, when tracing between the model and the code, when you click a virtual block, it is highlighted yellow.

  • In the model Web view, you cannot open a referenced model diagram by double-clicking the Model block in the top model. Instead, open the code generation report for the referenced model by using the drop-down menu at the top of the report.

  • Stateflow® truth tables, events, and links to library charts are not supported in the model Web view.

  • Searching in the code generation report does not find or highlight text in the model Web view.

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

  • For a subsystem build, the traceability hyperlinks of the root level inport and outport blocks are disabled.

  • Traceability Limitations (Embedded Coder) that apply to tracing between the code and the actual model diagram.

Related Topics