| Using Stateflow | Search  Help Desk |
Imported Data
Similarly, you may want to access a data object that is externally (outside the Stateflow diagram, the machine, and the Simulink model) defined. By defining a data's scope to be Imported, the data can be accessed anywhere within the hierarchy of that machine (including any offspring of the machine). An Imported data object's parent is external. However, the data object needs an `adoptive' parent to resolve symbols for code generation. An Imported data object's adoptive parent must be the machine because the machine is the (highest) level in the Stateflow hierarchy that can interface to external sources. Importing the data object does not imply anything about what the external source does with the data object. It is the responsibility of the external source to make the Imported data object available (in the manner appropriate to the source) to make use of the right to access the data object. If the external source is another machine, then one machine defines an Imported data object and the other machine defines the same data object to be Exported. Stateflow generates the appropriate import and export data code for both machines. This example shows the format required if the data is Imported from an external code source (custom code).
4-2