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. 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.
A Simulink® Report Generator™ license is required to include a Web view (Simulink Report Generator) of the model in the code generation report.
Web view requires a Web browser that supports Scalable Vector Graphics (SVG). Web view uses SVG to render and navigate models.
You can use the following Web browsers:
Mozilla Firefox Version 1.5 or later, which has native support for SVG. To
download the Firefox browser, go to
Internet Explorer® Web browser with the Adobe® SVG Viewer plug-in. To download the Adobe SVG Viewer plug-in, go to
Apple Safari Web browser
This example shows how to create an HTML code generation report which includes a Web view of the model diagram.
Open the Configuration Parameters dialog box and navigate to the Code Generation pane.
ert.tlc for the System target
Open the Code Generation > Report pane.
Select the following parameters:
Create code generation report
Open report automatically
Generate model Web view
Select the parameters Code-to-model and Model-to-code.
These settings specify only the top model, not referenced models.
Open the Configuration Parameters for the referenced model,
rtwdemo_mdlrefbot and perform steps 3–6.
Save the models,
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.
In the left navigation pane, select a source code file. The corresponding source code is displayed in the right pane and includes hyperlinks.
Click a link in the code. The model Web view displays and highlights the corresponding block in the model.
To highlight the generated code for a referenced model block in your model,
CounterB. The corresponding code is highlighted in the
source code pane.
You cannot open the referenced model diagram in the Web view by double-clicking the referenced model block in the top model.
To open the code generation report for a referenced model, in the left
navigation pane, below Referenced Models, click the link,
rtwdemo_mdlrefbot. The source files for the referenced
model are displayed along with the Web view of the referenced 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 top model’s report is displayed.
For more information about exploring a model in a Web view, see Navigate the Web View (Simulink Report Generator).
For more information about navigating between the generated code and the model diagram, see Trace Simulink Model Elements in Generated Code.
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 referenced model block in the top model. Instead, open the code generation report for the referenced model by clicking a link under Referenced Models in the left navigation pane.
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, see Open Code Generation Report.
For a subsystem build, the traceability hyperlinks of the root level inport and outport blocks are disabled.
Traceability Limitations that apply to tracing between the code and the actual model diagram.