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.
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:
- Referenced Models
- Referenced Subsystems
- Masked Diagrams
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:
- 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 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.
Navigate Model Web View
1. In the model viewer pane, click View All. The tab displays diagrams of the systems in the sldemo_fuelsys
model.
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 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.
4. Click the input signal of the Outport
block to display 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:
- Navigate to the folder that contains the ZIP file.
- Extract the
sldemo_fuelsys_webview.zip
file. - In a browser, open the
webview.html
file.
For more information, see Web Views and Open Generated Web Views in Web Browser.