| Contents | Index |
| On this page… |
|---|
To use a Simulink.Signal object to define a data store without using a Data Store Memory block, create the signal object in a workspace that is visible to every component that needs to access the data store. The name of the associated data store is the name of the signal object. You can use this name in Data Store Read and Data Store Write blocks, just as if it were the Data store name of a Data Store Memory block. Simulink creates an associated data store when you use the signal object for data storage.
You can use a Simulink.Signal object to define either a local or a global data store.
If you define the object in the MATLAB base workspace, the result is a global data store, which is accessible in every model within Simulink, including all referenced models.
If you create the object in a model workspace, the result is a local data store, which is accessible at every level in a model except any referenced models.
Data store attributes that a signal object does not define have the same default values that they do in a Data Store Memory block. The parameter values of a signal object used as a data store have different requirements, depending on whether the data store is global or local.
For a local data store, for each parameter listed in the following table, you can either set value explicitly or you can have the data store inherit the value from the Data Store Write and Data Store Read blocks.
The following table describes the parameter requirements for global data stores.
| Parameter | Global Data Store Value |
|---|---|
| DataType | Must be set explicitly |
| Complexity | Must be set explicitly |
| Dimensions | Must be set explicitly |
| SampleTime | Can be set or inherited |
| SamplingMode | Must be 'Sample based' |
For a local data store defined using a Data Store Memory block that uses a signal object for the Data store name parameter, you can select the Data store must resolve to Simulink signal object parameter for compile-time checking. The Data store must resolve to Simulink signal object parameter causes Simulink to display an error and stop compilation if Simulink cannot find the signal object or if the signal object properties are inconsistent with the signal object properties.
Once you have created the object, set the properties of the signal object to the values that you want the corresponding data store properties to have. For example, the following commands define a data store named Error in the MATLAB base workspace:
Error = Simulink.Signal; Error.Description = 'Use to signal that subsystem output is invalid'; Error.DataType = 'boolean'; Error.Complexity = 'real'; Error.Dimensions = 1; Error.SamplingMode='Sample based'; Error.SampleTime = 0.1;
![]() | Defining Data Stores with Data Store Memory Blocks | Accessing Data Stores with Simulink Blocks | ![]() |

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 |