Create and Use Web Views of Models - MATLAB & Simulink (original) (raw)

This example shows how to export a SimulinkĀ® model to a web view. You can view, navigate, and share a web view without a MATLABĀ® license.

Configure Browser

First, configure your browser to allow the web view file to access files and subfolders in the web views folder. For browser-specific instructions, see Open Generated Web Views in Web Browser.

Export Model to Web View

To create a web view from the sldemo_fuelsys model:

1. Open the model.

open_system("sldemo_fuelsys")

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

3. In the Simulink Toolstrip, on the Simulation tab, click Save > Web View. The Web View dialog box opens.

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

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

5. To enable users of the web view to interact with reference blocks, referenced subsystems, and masked blocks, under Include Options, select:

6. For Package name, use the default value, sldemo_fuelsys.

7. For Folder, enter the path of the fuelsys_webview folder that you created. If you do not specify a folder, the dialog box displays the path of the folder where you previously exported a web view of the model or the current MATLAB folder.

8. To avoid overwriting existing web view files, select If package exists, increment name to prevent overwriting.

9. Click Export. The web view exports and opens in the system browser.

Explore Web View

The web view consists of:

Web view of the sldemo_fuelsys model with model browser open. Labels indicate the model browser pane, explorer bar, model viewer pane, object inspector pane, and hide/show model browser button.

You can display a system by selecting it in the model browser, by double-clicking the system in the model viewer pane, or by clicking the diagram of the system on the View All tab.

1. In the model viewer pane, click View All. The tab displays diagrams of the systems in the sldemo_fuelsys model.

View All tab of the top-level of the sldemo_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 sldemo_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 Icon for Hide/Show Model Browser button 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 sldemo_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 sldemo_fuelsys in the explorer bar.

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

3. Click the Rate Transition block to display 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 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 Web View Without Opening 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 without opening MATLAB:

  1. Navigate to the folder that contains the ZIP file.
  2. Extract the sldemo_fuelsys_webview.zip file.
  3. In a browser, open the webview.html file.

For more information, see Web Views and Open Generated Web Views in Web Browser.

See Also

Topics