Create and Use Web Views of Models
This example shows how to export a Simulink® model to a web view. You can view, navigate, and share a web view without a Simulink license.
This example creates a web view from the slrgex_fuelsys
model.
Run the following command to access the supporting files used in this example.
openExample('rptgenext/SimulinkReportGeneratorFilesExample');
Set Up Browser
Before you can open a web view file in Microsoft Edge® or Google Chrome®, you must set up the browser to allow the web view file to access files and subfolders in the web views folder. See Open Generated Web Views in Web Browser.
Open Model
Open the slrgex_fuelsys
model.
open_system("slrgex_fuelsys");
Create Folders for Web View Files
Create a writable folder called fuelsys_webview
so that you can
export the model web view files to this folder.
Export Models to Web Views
In Simulink, on the Simulation tab, in the File section, click Save . Under Export Model To, select Web View.
The Web View dialog box opens.
To export the whole model, under Systems to Export, select Entire Model.
To enable users of the web view to interact with reference blocks, under Include Options, select Referenced Models.
To enable users of the web view to interact with referenced subsystems, under Include Options, select Referenced Subsystems.
To enable users of the web view to interact with masked blocks, select Masked Diagrams.
Leave the default Package name value,
slrgex_fuelsys
.In the Folder text box, enter the path of the
fuelsys_webview
folder that you created.If you do not specify a folder, by default the Folder text box contains the path of the folder where you previously exported a web view of the model or the current MATLAB® folder.
Select the If package exists, increment name to prevent overwriting check box. Selecting this option ensures that you do not overwrite the web view files if you export multiple web views from the same model. The web view dialog box now looks like this:
Click Export.
The web view exports and opens in the system browser.
Explore Web Views
The web view consists of:
The model viewer pane, which displays the model or selected system. By default, this pane displays the model or top-level system that you exported.
The View All tab, which displays diagrams of all the systems.
The model browser pane, which displays a hierarchical tree of the systems. By default, the model browser pane is hidden. To open it, click the Hide/Show Model Browser button in the lower-left corner of the model viewer pane. By default, the model browser displays the top-level systems. Expand the tree nodes to see all systems in the hierarchy.
The object inspector pane, which lists the parameters or properties of models, systems, blocks or signals.
The explorer bar, which displays the path of the displayed system in the model.
You can display a system by selecting the system in the model browser, double-clicking the system in the model viewer pane, or clicking the diagram of the system on the View All tab.
Navigate Through slrgex_fuelsys
Model Web View
In the display pane, click View All.
The tab displays diagrams of all the systems in the
slrgex_fuelsys
model.Click the third diagram in the top row, which is the diagram of the
Engine Gas Dynamics
system.The model viewer pane displays the
Engine Gas Dynamics
system.Return to the top level of the model by clicking
slrgex_fuelsys
in the explorer bar.In the model viewer pane, double-click the
To Controller
system.The model viewer pane displays the
To Controller
system, which is a masked SubSystem. You can interact with theTo Controller
subsystem because you included masked subsystems when you exported the model.If the model browser is not open, click the Hide/Show Model Browser button in the lower-left corner of the model viewer pane.
Expand the
Engine Gas Dynamics
node and click theMixing and Combustion
system.The
Mixing and Combustion
system displays in the model viewer pane.Return to the top level of the model by clicking
slrgex_fuelsys
in the explorer bar.In the model viewer pane, double-click the
fuel-rate control
system.The model viewer pane displays the
fuel-rate control
system, which is a model reference. You can interact with thefuel-rate control
system because you included referenced models when you exported the model.
Display Parameters and Properties of Blocks and Signals
Return to the top level of the model by clicking
slrgex_fuelsys
in the explorer bar.In the model browser pane, select the
To Plant
system.Click the Rate Transition block to view the block parameter values.
Click the input signal of the Outport block to display the signal properties.
Move and Zoom in on Diagrams in Model Viewer Panes
To move the diagram in the model viewer pane, click and drag the mouse scroll wheel.
To zoom in and out on the diagram, use the mouse scroll wheel.
Open Web Views Outside MATLAB
By default, exporting a web view creates a ZIP file that includes the web view HTML file and files that support the web view display. To open the web view outside of MATLAB:
Navigate to the folder that contains the ZIP file.
Extract the
slrgex_fuelsys_webview
ZIP file.Open the
webview.html
file in a browser.