| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
Signal Routing

The Data Store Memory block defines and initializes a named shared data store, which is a memory region usable by Data Store Read and Data Store Write blocks that specify the same data store name.
The location of the Data Store Memory block that defines a data store determines which Data Store Read and Data Store Write blocks can access the data store:
If the Data Store Memory block is in the top-level system, the data store can be accessed by Data Store Read and Data Store Write blocks located anywhere in the model.
If the Data Store Memory block is in a subsystem, the data store can be accessed by Data Store Read and Data Store Write blocks located in the same subsystem or in any subsystem below it in the model hierarchy.
A Data Store Memory block in a referenced model cannot be accessed by Data Store Read or Data Store Write blocks in either a superior model or a subordinate model.
You initialize the data store by specifying a scalar value or an array of values in the Initial value parameter. The dimensions of the array determine the dimensionality of the data store. Any data written to the data store must have the dimensions designated by the Initial value parameter. Otherwise, an error occurs.
Obtaining correct results from data stores requires ensuring that data store reads and writes occur in the expected order. See Ordering Data Store Access and Using Data Store Diagnostics for details.
You can use Simulink.Signal objects in addition to or instead of Data Store Memory blocks to define data stores. A data store defined in the base workspace using a signal object is accessible to every model, including all referenced models. See Working with Data Stores for more information.
The Data Store Memory block stores real or complex signals of any data type supported by Simulink software, including fixed-point and enumerated data types.
For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink.
The Main pane of the Data Store Memory block dialog appears as follows:

Specify a name for the data store you are defining with this block. Data Store Read and Data Store Write blocks with the same name will be able to read from and write to the data store initialized by this block.
This parameter lists all the Data Store Read and Data Store Write blocks that have the same data store name as the current block, and that are in the current (sub)system or in any subsystem below it in the model hierarchy. Double-click any entry on this list to highlight the block and bring it to the foreground.
Specify the initial value or values of the data store. The dimensions of this value determine the dimensions of data that may be written to the data store. The Minimum parameter specifies the minimum value for this parameter, the Maximum parameter specifies the maximum value.
Causes Simulink software, when compiling the model, to search the model and base workspace for a Simulink.Signal object having the same name, as described in Resolving Symbols. If such an object is not found, Simulink software halts the compilation and displays an error. Otherwise Simulink software compares the attributes of the signal object with the corresponding attributes of the data store memory block. If the block and the object attributes are inconsistent, Simulink software halts model compilation and displays an error.
These following parameters pertain to code generation and have no effect during simulation:
Data store name must resolve to Simulink signal object
RTW storage class
RTW type qualifier
See Block State Storage and Interfacing Considerations in the Real-Time Workshop documentation for more information.
If selected and the Initial value parameter is specified as a column or row matrix, the data store is initialized to a 1-D array whose elements are equal to the elements of the row or column vector. See Determining the Output Dimensions of Source Blocks.
The Signal Attributes pane of the Data Store Memory block dialog appears as follows:

Specify the minimum value that the block should output. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values)
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
Specify the maximum value that the block should output. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values)
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
Specify the output data type. You can set it to:
A rule that inherits a data type, for example, Inherit: auto
The name of a built-in data type, for example, single
The name of a data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Data
type parameter.
See Specifying Block Output Data Types for more information.
Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see Fixed-Point Tool and Fixed-Point Advisor in the Simulink Fixed Point documentation.
Specify the numeric type, real or complex, of the values stored in the data store.
The Diagnostics pane of the Data Store Memory block dialog appears as follows:

Select the diagnostic action to take if the model attempts to read data from a data store to which it has not written data in this time step. See also Detect read before write in the Data Store Memory Block section of the Configuration Parameters > Diagnostics > Data Validity pane.
Default: warning
Select the diagnostic action to take if the model attempts to write data to the data store after previously reading data from it in the current time step. See also Detect write after read in the Data Store Memory Block section of the Configuration Parameters > Diagnostics > Data Validity pane.
Default: warning
Select the diagnostic action to take if the model attempts to write data to the data store twice in succession in the current time step. See also Detect write after write in the Data Store Memory Block section of the Configuration Parameters > Diagnostics > Data Validity pane.
Default: warning
Sample Time | N/A |
Dimensionalized | Yes |
Multidimensionalized | Yes |
![]() | Counter Limited | Data Store Read | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |