Main Content

slrealtime.exportRun

Access data for Simulation Data Inspector run

Since R2023a

Description

dataSet = slrealtime.exportRun(runID) exports the data from the Simulation Data Inspector run corresponding to runID.

example

dataSet = slrealtime.exportRun(runID,Name=Value) specifies additional options using one or more name-value pair arguments.

Note

The slrealtime.exportRun function is very similar to the Simulink.sdi.exportRun function with few arguments. Use the slrealtime.exportRun function for deployed applications.

example

Examples

collapse all

Open the slrt_ex_osc model.

mdlName = 'slrt_ex_osc';
openExample(mdlName);

In the Simulink Editor, on the Real-Time tab, click Hardware Settings.

In the Simulink Real-Time Options pane, change Max file log runs to 5 and click OK.

Click Run on Target.

Navigate to the parent of the applications folder and list the file logs that are available to export from the Simulation Data Inspector.

runs = Simulink.sdi.getAllRunIDs
run=runs(end-1)

Export the file log for the penultimate run from the Simulation Data Inspector to a MAT file named dataPenultimateRun.

runID=runs(end-1)
dataset=slrealtime.exportRun(runID,to="file",fileName="dataPenultimateRun.mat");

Input Arguments

collapse all

Run identifier specified as a positive integer or vector of positive integers. for the run you want a .MAT file for. The Simulation Data Inspector assigns run identifiers when you create runs. Get the identifier for a run using Simulink.sdi.getAllRunIDs or Simulink.sdi.getRunIDByIndex.

To export data for multiple runs to a file, you can specify the runID input as a vector of run IDs.

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: filename='file_run.MAT'

Option to export data to a workspace variable or a MAT file, specified as "variable" or "file".

When you export data to a file, you must also specify a file name using the filename name-value argument.

Example: "file"

Name of .MAT file, specified as a character vector or string scalar. The slrealtime.exportRun function exports only MAT files and does not support others formats.

Example: "file_run.MAT"

Dependency

To enable this argument, specify the to argument as file.

Output Arguments

collapse all

Data for the run corresponding to the run identifier runID, returned as a variable or .MAT file.

Version History

Introduced in R2023a