Saving and Retrieving Logged Simulation Data
Ways of saving and retrieving logged simulation data depend on the logging method. Each
simulation log has two properties,
exportable, that indicate how the data was logged and therefore, how to
save and retrieve it.
Stream data to temporary disk directory preference is off, Record data in Simulation Data Inspector option is off
Temporary File on Disk
Stream data to temporary disk directory preference is on, Record data in Simulation Data Inspector option is off
Simulation Data Inspector
Record data in Simulation Data Inspector option is on
Simulation Data Inspector data management functions, Analyze Simulation Results
Data Logged to Memory
When you log simulation data to workspace (Stream data to temporary disk directory check box on the Simscape pane of the Preferences dialog box is off), all the data is stored in the workspace variable. You can use the regular MATLAB interface to save the workspace variable as a MAT-file and load a MAT-file into a variable. For more information, see Workspace Variables and MAT-Files.
Data Logged to Temporary File on Disk
When you stream simulation data to disk (Stream data to temporary disk
directory check box on the Simscape pane of the
Preferences dialog box is on), the data is stored as a
simlog object in a
temporary file, and the workspace variable references the
The temporary file persists as long as there is a logging variable name in the workspace
that references it. The
simscape.logging.export function saves the
logged simulation data to an MLDATX file, other than the temporary file, for use in a later
session. To load the MLDATX file containing the stored
simlog object back
into workspace and associate it with a workspace variable, use the
The following restrictions apply:
When streaming data to disk, you can export and import only the entire
simlogobject. This is different from logging data to workspace, where you can save part of the workspace variable (such as a node in the
simlogtree) as a separate MAT-file.
simscape.logging.exportfunction does not support cross-locale characters in file name.
Data Recorded in Simulation Data Inspector
If you select the Record data in Simulation Data Inspector check
box on the Simscape pane of the Configuration Parameters dialog box for
a particular model, this choice overrides the logging preference. The
simlog object has both
exportable properties set to
0. You must use the
Simulation Data Inspector data management functions to save and retrieve this data. For more
information, see Analyze Simulation Results.