Contenido principal

Simulink.sdi.clear

R2026b

Clear all data from the Simulation Data Inspector

Description

Simulink.sdi.clear clears all plotted signals across all tabs (since R2026b) and deletes all logged data from the Simulation Data Inspector repository. Logged data and the Simulation Data Inspector share the same temporary repository. Signals are always logged to the repository, even when you are not using the Simulation Data Inspector to visualize data.

Simulink.sdi.clear does not affect preferences or settings you have configured in the Simulation Data Inspector. To reset the Simulation Data Inspector preferences to their default values, use Simulink.sdi.clearPreferences.

To clear all plotted signals in all tabs without deleting any data from the Simulation Data Inspector, use Simulink.sdi.clearAllSubPlots.

example

Simulink.sdi.clear(Export=tf) where tf is false, does not export data to the workspace before deleting data from the Simulation Data Inspector repository. The default for tf is true, which allows the Simulation Data Inspector to export data to the workspace before deleting runs from the repository.

example

Examples

collapse all

To prevent logged simulation data from accumulating in the DMR file, periodically start a new Simulation Data Inspector session or clear the repository.

Simulink.sdi.clear

Some logging techniques, such as signal logging, use on-demand loading. When the software loads data on demand, a variable is created in the workspace, but the data itself remains on disk until accessed. By default, Simulink.sdi.clear exports this on-demand data from the current run to the workspace. To clear the repository faster and without loading on-demand data into memory, set Export=false.

Suppose that you logged simulation data using a combination of signal logging, an Outport block, a To Workspace block, and a Record block configured to record data to the workspace.

out = 

  Simulink.SimulationOutput:

                logsout: [1x1 Simulink.SimulationData.Dataset] 
              recordout: [1x1 Simulink.SimulationData.Dataset] 
                 simout: [1x1 timeseries] 
                   tout: [51x1 double] 
                   yout: [1x1 Simulink.SimulationData.Dataset] 

     SimulationMetadata: [1x1 Simulink.SimulationMetadata] 
           ErrorMessage: [0x0 char]  

The software loads signal logging and output data into memory on demand, while a To Workspace block or a Record block that is configured to record data to the workspace loads data into memory when the simulation is paused, stopped, or completed. All four signals have a variable in the workspace, but only simout and recordout are loaded into memory before being needed.

Without accessing the data, clear the repository and set Export=false.

Simulink.sdi.clear(Export=false)

The data logged using the To Workspace and Record blocks is still accessible because these blocks automatically load data into memory.

toWorkspaceData = out.simout
  timeseries

  Common Properties:
            Name: ''
            Time: [51x1 double]
        TimeInfo: [1x1 tsdata.timemetadata]
            Data: [51x1 double]
        DataInfo: [1x1 tsdata.datametadata]

  More properties, Methods

The signal logging and output data is no longer accessible because it was never loaded into memory.

sigLoggingData = out.logsout
sigLoggingData = 

Simulink.SimulationData.Dataset 'logsout' with 0 elements

  - Use braces { } to access, modify, or add elements using index.

Input Arguments

collapse all

Whether to export data to the workspace, specified as one of these options:

  • true(default) — Data is exported to the workspace before being deleted from the Simulation Data Inspector repository.

  • false — Data is not exported to the workspace before being deleted from the Simulation Data Inspector repository.

Example: Simulink.sdi.clear(Export=false)

Version History

Introduced in R2011b

expand all