Stateflow® local and output data in 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.
When Stateflow local or output data resolve to Simulink signal objects, they inherit these properties:
Storage class controls the appearance of chart data in the generated code. See Control Data Representation by Applying Custom Storage Classes (Embedded Coder).
To enable explicit signal resolution, follow these steps:
Set Configuration Parameters > Diagnostics > Data Validity > Signal resolution to a value
None. For more information about
the other options, see Signal resolution (Simulink).
In the model workspace, base workspace, or data dictionary, define a
Simulink.Signal object with the properties you want your Stateflow data to inherit.
For more information about creating Simulink signals, see
Add output or local data to a chart.
Enter a name for your data that matches the name of the
In the data properties, select the Data must resolve to signal object check box.
After you select this check box, the dialog box removes or grays out the properties that your data inherits from the signal. For a list of properties that your data can inherit during signal resolution, see Inherited Properties.
The following model shows how a chart resolves local and output data to
In the base workspace, there are three
Simulink.Signal objects with these
|Name||Data Type||Dimensions||Storage Class|
The 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
local to be an exported global variable:
/* * Exported States * * Note: Exported states are block states with an exported * global storage class designation. * */ extern real32_T local; /* '<Root>/Chart' */