Main Content


Container for data store logging information


Simulink.SimulationData.DataStoreMemory objects store logging information from Data Store Memory blocks during simulation. DataStoreMemory objects contain information about the blocks that write to the data store.


When a model is configured to log data stores, simulating that model creates a Simulink.SimulationData.DataStoreMemory object for each Data Store Memory block that is configured for logging.



dsmobj = Simulink.SimulationData.DataStoreMemory creates an empty Simulink.SimulationData.DataStoreMemory object.


expand all

Name of DataStoreMemory object to use for name-based access, specified as a string or character vector.

Block path of source Data Store Memory block for logged data store, specified as a Simulink.SimulationData.BlockPath object.

Scope of data store, specified as "local" or "global".

This property is read-only.

Block path of blocks that write to the data store, specified as a vector of Simulink.SimulationData.BlockPath objects. Each element of the vector contains the full block path of one writer block.

This property is read-only.

Number of writes in data store, specified as an integer vector.

The nth element of DSMWriters contains the index of the element in DSMWriterBLockPaths that contains the block path of the writer that performs the nth write to Values.

Logged time and data, specified as a timeseries object.


collapse all

The simpleDSM model contains a Data Store Memory block that defines and initializes the data store named A and is configured for logging. The model also contains a Sine Wave block connected to a Data Store Write block that writes to data store A. Data store logging is enabled for the model. When you simulate a model with logged data stores, the software saves data store data in one or more Simulink.SimulationData.DataStoreMemory objects.

Open the model. Then, simulate the model.

mdl = "simpleDSM";
out = sim(mdl);

The simpleDSM model

Simulation output is grouped into a Simulink.SimulationOutput object named out. Logged data store data is stored as a property of the SimulationOutput object with the default name dsmout.

out = 
                 dsmout: [1x1 Simulink.SimulationData.Dataset] 
                   tout: [51x1 double] 

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

To access the Simulink.SimulationData.Dataset object that contains data store data, use dot notation.

dsmData = out.dsmout
dsmData = 
Simulink.SimulationData.Dataset 'dsmout' with 1 element

                                  Name  BlockPath                   
                                  ____  ___________________________ 
    1  [1x1 DataStoreMemory]      A     simpleDSM/Data Store Memory

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

Use braces to access the Simulink.SimulationData.DataStoreMemory object that contains logging information from the Data Store Memory block.

dsm = dsmData{1}
dsm = 
  Package: Simulink.SimulationData

                   Name: 'A'
              BlockPath: [1x1 Simulink.SimulationData.BlockPath]
                  Scope: 'local'
    DSMWriterBlockPaths: [1x1 Simulink.SimulationData.BlockPath]
             DSMWriters: [51x1 uint32]
                 Values: [1x1 timeseries]

Version History

Introduced in R2011a