|On this page…|
The following examples illustrate techniques for defining and accessing data stores. See Order Data Store Access for techniques that control data store access over time, such as ensuring that a given data store is always written before it is read. See Data Store Diagnostics for techniques you can use to help detect and correct potential data store errors without needing to run any simulations.
The following model illustrates creation and access of a local data store, which is visible only in a model or particular subsystem.
This model uses a data store to permit subsystem A to signal that its output is invalid. If subsystem A's output is invalid, the model uses the output of subsystem B.
The following model replaces the subsystems of the previous example with functionally identical referenced models to illustrate use of a global data store to share data in a model reference hierarchy.
In this example, the top model uses a signal object in the MATLAB® workspace to define the error data store. This is necessary because data stores are visible across model boundaries only if they are defined by signal objects in the MATLAB workspace.