Stateflow User's Guide Previous page   Next Page

Importing Data from External Stateflow Code

A Stateflow machine can import definitions of data defined by external code that embeds the Stateflow machine. Importing externally defined data enables a Stateflow machine to access data defined by the system in which it is embedded.

To import externally defined data into the Stateflow machine, do the following:

  1. In the Model Explorer, add a data to the Simulink model.
  2. Set the Scope property of the data to Imported.

For each imported item, the Stateflow code generator assumes that external code provides a prototype 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 int32 integer named counter. The Stateflow code generator expects the item to be defined in the external C code as

See Imported Data for an example of Stateflow external code data imported into Stateflow.


Previous page  Exporting Data to External Stateflow Code Typing Stateflow Data Next page

© 1994-2005 The MathWorks, Inc.