| Stateflow® | ![]() |
| On this page… |
|---|
About Explicit Signal Resolution |
Stateflow local and output data in Stateflow charts can explicitly inherit properties from Simulink.Signal objects in the model workspace or base workspace. This process is called signal resolution and requires that the resolved signal have the same name as the chart output or local data.
For information about Simulink signal resolution, see Resolving Symbols and Hierarchical Symbol Resolution in the Simulink documentation.
When Stateflow local or output data resolve to Simulink signal objects, they inherit these properties:
Size
Complexity
Type
Minimum value
Maximum value
Initial value
Storage class
Storage class controls the appearance of Stateflow chart data in the generated code. See Working with Data in the Real-Time Workshop User's Guide.
To enable explicit signal resolution, follow these steps:
In the model workspace or base workspace, define a Simulink.Signal object with the properties you want your Stateflow data to inherit.
For more information about creating Simulink signals, see Simulink.Signal in the Simulink Reference documentation.
Add output or local data to a Stateflow chart.
The Data properties dialog box opens.
Enter a name for your data that matches the name of the Simulink.Signal object.
In the Data properties dialog box, select the Data must resolve to Simulink signal object check box, as in this example.

After you check this box, the dialog box removes or grays out the properties that your data will inherit from the signal.

For a list of properties that your data can inherit during signal resolution, see Inherited Properties.
This topic presents an example that demonstrates how a Stateflow chart resolves local and output data to Simulink.Signal objects. To open the model, click sf_resolve_signal_object, or type sf_resolve_signal_object at the MATLAB command prompt. The model appears as shown.

In the base workspace, there are three Simulink.Signal objects with these properties:

The Stateflow chart contains three data objects — two outputs and a local variable — that will resolve to a signal with the same name, as follows:

When you build the model, each data object inherits the properties of the identically named signal:

The generated code declares the data based on the storage class that the data inherits from the associated Simulink signal. For example, the header file below declares the local as an exported global variable:

![]() | Defining Temporary Data | Best Practices for Using Data in Stateflow Charts | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |