Main Content

Create and Use a Web View of a Model

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.

Set Up the 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 a Web View File in a Web Browser.

Open the Model

Open the slrgex_fuelsys model.

open_system("slrgex_fuelsys");

Create a Folder for the Web View Files

Create a writable folder called fuelsys_webview so that you can export the model web view files to this folder.

Export the Model to a Web View

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

  2. To export the whole model, under Systems to Export, select Entire Model.

  3. To enable users of the web view to interact with reference blocks, under Include Options, select Referenced Models.

  4. To enable users of the web view to interact with masked blocks, select Masked Subsystems.

  5. Leave the default Package name value, slrgex_fuelsys.

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

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

    Web view dialog box for the slrgex_fuelsys model showing the options for this example.

  8. Click Export.

The web view exports and opens in the system browser.

Navigate a Web View

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.

Web view of the slrgex_fuelsys model with model browser open. The model browser pane, explorer bar, model viewer pane, object inspector pane, and hide/show model browser button are labeled.

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 the Web View of the slrgex_fuelsys Model

  1. In the display pane, click View All.

    The tab displays diagrams of all the systems in the slrgex_fuelsys model.

    View All tab of the top-level of the slrgex_fuelsys web view.

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

  3. Return to the top level of the model by clicking slrgex_fuelsys in the explorer bar.

  4. 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 the To Controller subsystem because you included masked subsystems when you exported the model.

  5. If the model browser is not open, click the Hide/Show Model Browser button in the lower-left corner of the model viewer pane.

  6. Expand the Engine Gas Dynamics node and click the Mixing and Combustion system.

    The Mixing and Combustion system displays in the model viewer pane.

  7. Return to the top level of the model by clicking slrgex_fuelsys in the explorer bar.

  8. 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 the fuel-rate control system because you included referenced models when you exported the model.

Display Parameters and Properties of Blocks and Signals

  1. Return to the top level of the model by clicking slrgex_fuelsys in the explorer bar.

  2. In the model browser pane, select the To Plant system.

  3. Click the Rate Transition block to view the block parameter values.

    The web view model viewer pane displays the To Plant system. The Rate Transition block is highlighted and the object inspector pane displays the block parameters.

  4. Click the input signal of the Outport block to display the signal properties.

    The web view model viewer pane displays the To Plant system. The input signal of the Outport block is highlighted and the object inspector pane shows the signal properties.

Move and Zoom in on Diagrams in the Model Viewer Pane

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 the Web View Outside of 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:

  1. Navigate to the folder that contains the ZIP file.

  2. Extract the slrgex_fuelsys_webview ZIP file .

  3. Open the webview.html file in a browser.

See Web Views and Open a Web View File in a Web Browser.

Related Topics