Skip to Main Content Skip to Search
Product Documentation

Defining Data Stores with Signal Objects

Creating the Data Store

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.

Local and Global Data Stores

You can use a Simulink.Signal object to define either a local or a global data store.

Specifying Signal Object Data Store Attributes

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.

ParameterGlobal Data Store Value
DataTypeMust be set explicitly
ComplexityMust be set explicitly
DimensionsMust be set explicitly
SampleTimeCan be set or inherited
SamplingModeMust 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;
  


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