Hauptinhalt

Simulink.sdi.saveView

R2026b

Save visualization settings to apply to other data

Description

Simulink.sdi.saveView(filename) saves the current view across all tabs in the Simulation Data Inspector to the file, filename.

A view contains information about the layouts and plots in the graphical viewing area across all tabs (since R2026b), as well as properties of plotted signals. When you load a view, the Simulation Data Inspector uses the properties and preferences in the file to display data currently in the Simulation Data Inspector. Signals in the Simulation Data Inspector that align with the signals in the view are plotted in the graphical viewing area. Use a view to apply a consistent set of visualization settings to multiple sets of similar data.

The view file saves the following information:

  • Tabs, subplot layouts and visualization types

  • Settings for each visualization type in the layout

  • Signal selection mode

  • Replay controls visibility

  • Metadata displayed in the work area

  • Settings for signal grouping in the work area

  • Plotted signals and the line style and color for each plotted signal

Note

Log or import data into the Simulation Data Inspector before loading a saved view. The software applies a saved view only if the Simulation Data Inspector contains signals that align with the view. If there are no matching signals, the view is not applied and any new logged or imported signals do not inherit the visualization settings in the saved view.

A view file does not contain data. To save run data, export the data or save a session using the Simulink.sdi.save function.

example

Examples

collapse all

Save the current Simulation Data Inspector visualization settings to a view file. The view file stores the subplot layout, line styles, and colors, but does not store signal data. You can load the saved view later to apply the same visualization settings to new data.

Configure the Simulation Data Inspector layout and plot signals.

Simulink.sdi.setSubPlotLayout(2,2)
runObj = Simulink.sdi.getRun(runID);
sig = getSignalByIndex(runObj,1);
sig.LineStyle = "--";
sig.LineColor = [0 0.4 0.8];
plotOnSubplot(sig,1,1,true)

Save the visualization settings to a view file.

Simulink.sdi.saveView("myView.mldatx")

Input Arguments

collapse all

Name of the view file, specified as a string or character array.

Example: "myView.mldatx"

Data Types: char | string

Version History

Introduced in R2020a