This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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, savable and exportable, that indicate how the data was logged and therefore, how to save and retrieve it.

Logging MethodEnabled BySavableExportableUse

Memory

Stream data to temporary disk directory preference is off, Record data in Simulation Data Inspector option is off

1

0

MATLAB® save and load functions, Workspace Variables and MAT-Files (MATLAB)

Temporary File on Disk

Stream data to temporary disk directory preference is on, Record data in Simulation Data Inspector option is off

0

1

simscape.logging.export and simscape.logging.import

Simulation Data Inspector

Record data in Simulation Data Inspector option is on

0

0

Simulation Data Inspector data management functions, Inspect and Analyze Simulation Results (Simulink)

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 (MATLAB).

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 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 HDF5 file, other than the temporary file, for use in a later session. To load the HDF5 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 simlog object. This is different from logging data to workspace, where you can save part of the workspace variable (such as a node in the simlog tree) as a separate MAT-file.

  • simscape.logging.export function 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 savable and 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 Inspect and Analyze Simulation Results (Simulink).

Related Topics