Stateflow | ![]() ![]() |
Exporting Data
Stateflow can export definitions of Stateflow machine data to external code that embeds the machine. Exporting data enables external code, as well as the machine, to access the data. To export a data item, first add it to the data dictionary as the child of the Stateflow machine in which it is defined. Then set its Scope property to Exported
and its other properties (for example, Name
and Type
) to appropriate values.
Note Only a Stateflow machine (see machine) can parent external data. This means that you must use the Explorer to add external data to the data dictionary. It also means that external data are visible everywhere in the machine. |
The Stateflow code generator generates a C declaration for each exported data item of the form
where type
is the C type of the exported item (for example, int16
, double
, and so on) and data
is the item's Stateflow name. For example, suppose that your Stateflow machine defines an exported integer
item named counter
. The Stateflow code generator exports the item as the C declaration
The code generator includes declarations for exported data in the generated target's global header file, thereby making the declarations visible to external code compiled into or linked to the target.
![]() | Defining Temporary Data | Importing Data | ![]() |