Saving and Retrieving Logged Simulation Data
R2026bWays of saving and retrieving logged simulation data depend on the logging method. Each
simulation log has two properties, savable and
exportable, that indicate how the data was logged and therefore, how to
save and retrieve it.
| Logging Method | Enabled By | Savable | Exportable | Use |
|---|---|---|---|---|
Memory | Stream data to temporary disk directory setting is off |
|
| MATLAB®
|
Temporary File on Disk | Stream data to temporary disk directory setting is on |
|
|
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 Settings 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 Settings
dialog box is on), the data is stored as a simlog object in a temporary
file, and the workspace variable references the simlog object. 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 simscape.logging.import function.
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 thesimlogtree) as a separate MAT-file.simscape.logging.exportfunction does not support cross-locale characters in file name.