Skip to Main Content Skip to Search
Product Documentation

Defining Data Stores with Data Store Memory Blocks

Creating the Data Store

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.

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.

Specifying Data Store Memory Block Attributes

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 Simulink.Signal object to specify the attributes explicitly.

Specifying Attributes Using Block Parameters

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 uint16 and the Signal type to real.

Specifying Attributes Using a Signal Object

You can use a Simulink.Signal object to specify data store attributes. To establish an implicit data store, as described in Defining Data Stores with Signal Objects, use the same general approach as when you explicitly associate a data object with a Data Store Memory block.

The next figure shows a Data Store Memory block named A that specifies resolution to a Simulink.Signal object, named A. To use a signal object for the data store, select the Data store name must resolve to Simulink signal object parameter and set Data store name to the name of the signal object.

The signal object specifies values for all three data attributes that the data store would otherwise inherit: DataType, Complexity, and SampleTime. In this example, the Simulink.Signal object A might have the following properties:

A =
 
Simulink.Signal (handle)
           RTWInfo: [1x1 Simulink.SignalRTWInfo]
       Description: ''
          DataType: 'auto'
               Min: []
               Max: []
          DocUnits: ''
        Dimensions: 1
    DimensionsMode: 'auto'
        Complexity: 'auto'
        SampleTime: -1
      SamplingMode: 'auto'
      InitialValue: ''
  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS