Stateflow | ![]() ![]() |
Importing Data
A Stateflow machine can import definitions of data defined by external code that embeds the Stateflow machine. Importing externally defined data enables the machine to access data defined by the system in which it is embedded. To import an externally defined data item into a Stateflow machine, add a default item to the data dictionary as a child of the machine. Then set the new item's Scope property to Imported
, its Name property to the name used by the machine's actions to reference the item, and its other properties (for example, Type, Initial Value, and so on) to appropriate values.
The Stateflow code generator assumes that external code provides a prototype for each imported item of the form
where type
is the C data type corresponding to the Stateflow data type of the imported item (for example, int
for Integer
, double
for Double
, and so on) and data
is the item's Stateflow name. For example, suppose that your Stateflow machine defines an imported integer
item named counter
. The Stateflow code generator expects the item to be defined in the external C code as
![]() | Exporting Data | Action Language | ![]() |