Main Content

slwebview

Export Simulink models to web views

Description

slwebview starts the web view dialog box in the Report Explorer.

filename = slwebview(system_name) exports the subsystem system_name and its child systems to the file filename.

example

filename = slwebview(folder) exports all models in a folder. See RecurseFolder to include models in subfolders.

filename = slwebview(system_name,Name=Value) provides additional options specified by one or more Name=Value pairs.

example

Examples

collapse all

Open the slrgex_fuelsys model.

open_system("slrgex_fuelsys")

Export the Engine Gas Dynamics subsystem and the system that contains it to a web view. Do not export the subsystems that it contains.

fuelsys_web_view1 = slwebview(...
"slrgex_fuelsys/Engine Gas Dynamics","SearchScope","CurrentAndAbove")
fuelsys_web_view1 = 
'C:\Users\sheile\OneDrive - MathWorks\Documents\MATLAB\ExampleManager\sheile.Bdoc\rptgenext-ex97298442\Engine_Gas_Dynamics.zip'

Navigate to the Engine_Gas_Dynamics folder and open webview.html in a web browser. See Display and Navigate Through Web Views. Here is the web view:

slwebview_fuelsys.png

Open the slrgex_fuelsys model.

open_system("slrgex_fuelsys")

Export the model to a web view and allow access to the models it references.

fuelsys_web_view2 = slwebview(...
"slrgex_fuelsys","FollowModelReference","on")
fuelsys_web_view2 = 
'/tmp/Bdoc24b_2725827_4037772/tpcd537c83/rptgenext-ex83825438/slrgex_fuelsys.zip'

Navigate to the slrgex_fuelsys folder and open webview.html in a web browser. See Display and Navigate Through Web Views. Here is the web view:

slwebview_fuelsys2.png

Click the fuel_rate_control block to see its properties. Double-click the fuel_rate_control block to display the referenced model.

Input Arguments

collapse all

Exports the specified system or subsystem and its child systems to a web view file. By default, child systems of the system_name system are also exported. Use the SearchScope name-value pair to export other systems, in relation to system_name.

Path to the file folder containing one or more models to export to a web view file, specified as a string. All models in the folder are exported.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: htmlFileName = slwebview(gcs,'LookUnderMasks','all',... 'FollowLinks','on') Export to a web view all layers of the model hierarchy to which the current system belongs, including the ability to interact with library links and masks.

'CurrentAndBelow' exports the Simulink® system or the Stateflow® chart specified by system_name and all systems or charts that it contains.

'Current' exports only the Simulink system or the Stateflow chart specified by system_name.

'CurrentAndAbove' exports the Simulink system or the Stateflow chart specified by the system_name and all systems or charts that contain it.

'All' exports all Simulink systems or Stateflow charts in the model that contains the system or chart specified by system_name.

Data Types: char

'none' does not export masked blocks in the web view. Masked blocks are included in the exported systems, but you cannot access the contents of the masked blocks.

'all' exports all masked blocks.

Data Types: char

Whether to include behavior components defined in System Composer™ architecture models, specified as numeric or logical 0 (false) or 1 (true).

Data Types: logical

Whether to include user notes, specified as numeric or logical 0 (false) or 1 (true).

Data Types: logical

Whether to export the MATLAB functions used in MATLAB Function blocks or Stateflow charts to web view, specified as a numeric or logical 1 (true) or 0 (false).

Data Types: logical

'off' does not allow you to access referenced models in a web view.

'on' allows you to access referenced models in a web view.

Data Types: char

Since R2024b

Whether to export referenced subsystems in a webview, specified as "on" or "off". If true, the web view includes referenced subsystems. If false, the web view does not include referenced subsystems.

Data Types: string

Whether to export models in subfolders to a web View file, specified as a logical. If false, the web view includes models only in the top-level folder and does not include models in subfolders. If true, models in subfolders are also included. This property applies only if you specify a folder as an input argument.

Name of the web view output package, specified as a character vector. The web view output is a .zip file or folder of unzipped web view files, or both types of outputs.

Data Types: char

Path in which to place the packaged web view, specified as a character vector. To save the packaged web view in the same folder as the model, use $model as the PackageFolder.

Data Types: char

Type of web view output package, specified as a zipped file, a folder of unzipped files, or both a zipped file and folder of unzipped files.

Data Types: char

Optional views to include, specified as a cell array that contains one or both of these values:

  • 'requirements'

  • 'coverage'

See Include Model Requirements and Coverage Data in Web Views.

true displays the web view in a web browser when you export the web view.

false does not display the web view in a web browser when you export the web view.

Data Types: logical

true displays the status bar when you export a web view.

false does not display the status bar when you export a web view.

Data Types: logical

Option to export the model incrementally, specified as numeric 0 or 1 or logical true or false. Use IncrementalExport to specify whether to use full or incremental export mode.

If IncrementalExport is false, slwebview completely regenerates web views that you have previously exported.

If IncrementalExport and FollowModelReference are true:

  • When you export a model, slwebview reuses cached web views for the top model or referenced models or subsystems that have not changed since you last ran slwebview.

  • slwebview caches web views in the current simulation cache folder. To reuse existing web views, use a common simulation cache folder for web view export.

Only changes that dirty a model trigger web view regeneration. Certain changes to model behavior or model appearance do not dirty the model and thus do not trigger web view regeneration. For example, changing the name of a tunable parameter triggers regeneration, but changing the value of a tunable parameter does not trigger regeneration. To force regeneration of a web view, delete the model's simulation cache file in the current simulation cache folder.

Caching new or updated web views increases export time, but reusing cached web views reduces export time. For this reason, use incremental export only if you enable FollowModelReference and the model contains numerous model or subsystem references.

Data Types: logical | numeric

Output Arguments

collapse all

Reports the name of the HTML file for displaying the web view. Exporting a web view creates the supporting files, in a folder.

Tips

A web view is an interactive rendition of a model that you can view in a web browser. You can navigate a web view hierarchically to examine specific subsystems and to see properties of blocks and signals.

You can use web views to share models with people who do not have Simulink installed.

Note

When using color to differentiate sample times, only the colors for referenced models will be visible in the web view. Colors applied to referenced subsystems are not supported.

Version History

Introduced in R2006a

expand all