Contenu principal

Simulink.sdi.load

R2026b

Load Simulation Data Inspector session or view

Description

valid = Simulink.sdi.load(filename) loads data from the file specified by filename into the Simulation Data Inspector and returns 1 when the file is valid. You can load data from MAT files or MLDATX files. When you specify an MLDATX file, the software loads both the data and visualization settings into the Simulation Data Inspector.

Simulation Data Inspector views are also saved as MLDATX files. To load a view file, which does not include signal data, use the Simulink.sdi.loadView function.

valid = Simulink.sdi.load(filename,ClearExisting=tf), where tf is true, clears all existing data in the Simulation Data Inspector before loading data from the specified file. The default for tf is false, which keeps existing runs and adds the loaded runs to the archive. (since R2026b)

Before R2026b: When you load a session file that contains multiple tabs, the Simulation Data Inspector loads only the view from the tab that was active when the session was saved.

example

Examples

collapse all

Load a saved session and replace existing runs in the Simulation Data Inspector.

Suppose the Simulation Data Inspector contains three runs from previous simulations. Confirm the run count.

Simulink.sdi.getRunCount
ans =
     3

Load a saved session that contains data for one run. To clear the existing data first, use ClearExisting.

Simulink.sdi.load("mySession.mldatx",ClearExisting=true);

Verify that only the run from the loaded session remains.

Simulink.sdi.getRunCount
ans =
     1

Input Arguments

collapse all

Name of the session file or MAT file to load, specified as a string or character vector. To load data from an MLDATX file, specify the file extension.

Example: "myData.mldatx"

Example: "myData.mat"

Since R2026b

Option to clear existing data before loading, specified as a numeric or logical 1 (true) or 0 (false):

  • true — Clears all existing data in the Simulation Data Inspector before loading the file.

  • false (default) — Keeps existing runs in the Simulation Data Inspector and adds the loaded runs to the archive.

Example: Simulink.sdi.load("mySession.mldatx",ClearExisting=true)

Output Arguments

collapse all

File validity indicator, returned as 1 (true) or 0 (false). A return value of 0 indicates that the Simulation Data Inspector did not load the session file or did not import data from the MAT file.

Version History

Introduced in R2011b

expand all