To use a Data Store Memory block to define a data store, drag an instance of the block into the model at the topmost level from which you want the data store to be visible. The result is a local data store, which is not accessible within referenced models.
To define a data store that is visible at every level within a given model, except within Model blocks, drag the Data Store Memory block into the root level of the model.
To define a data store that is visible only within a particular subsystem and the subsystems that it contains, but not within Model blocks, drag the Data Store Memory block into the subsystem.
Once you have added the Data Store Memory block, use its parameters dialog box to define the data store's properties. The Data store name property specifies the name to of the data store that the Data Store Write and Data Store Read blocks access. See Data Store Memory documentation for details.
You can specify data store properties beyond those definable with Data Store Memory block parameters by selecting the Data store name must resolve to Simulink signal object option and using a signal object as the data store name. See Specifying Attributes Using a Signal Object for details.
A Data Store Memory block can inherit three data attributes from its corresponding Data Store Read and Data Store Write blocks. The inheritable attributes are:
However, allowing these attributes to be inherited can cause
unexpected results that can be difficult to debug. To prevent such
errors, use the Data Store Memory block dialog or a
to specify the attributes explicitly.
You can use the Data Store Memory block dialog box to specify
the data type and complexity of a data store. In the next figure,
the dialog box sets the Data type to
the Signal type to
You can use a
Simulink.Signal object to specify
data store attributes for a Data Store Memory block.
Tip To establish an implicit data store, as described in Data Stores with Signal Objects, use the same general approach as when you explicitly associate a signal object with a Data Store Memory block.
The next figure shows a Data Store Memory block that specifies
resolution to a
Simulink.Signal object, named
To use a signal object for the data store, set Data store
name to the name of the signal object. For compile-time
checking, open the Signal Attributes tab and
select the Data store name must resolve to Simulink signal
The signal object specifies values for all three data attributes
that the data store would otherwise inherit. In this example, which
defines a local data store, the
the following inherited properties:
A = Simulink.Signal (handle) CoderInfo: [1x1 Simulink.CoderInfo] Description: '' DataType: 'auto' Min:  Max:  DocUnits: '' Dimensions: 1 DimensionsMode: 'auto' Complexity: 'auto' SampleTime: -1 SamplingMode: 'auto' InitialValue: 0
For more information about specifying signal object attributes for local and global data stores, see Signal Object Attributes for Data Stores.