Skip to Main Content Skip to Search
Product Documentation

Best Practices for Using Data in Stateflow Charts

Avoid inheriting output data properties from Simulink blocks

Stateflow output data should not inherit properties from output signals, because the values back propagate from Simulink blocks and can be unpredictable.

In the Stateflow action language, inherited properties of outputs are determined solely by external information from Simulink models and not from the code. However, in the MATLAB action language — used in truth tables and MATLAB functions — inherited properties of outputs are determined solely from the code and the properties of the inputs.

Restrict use of machine-parented data

Use machine-parented data when you want to use global data definitions for Mealy and Moore charts, which do not support data store memory (see Building Mealy and Moore Charts for details). Otherwise, avoid using machine-parented data. The presence of machine-parented data in a model prevents reuse of generated code and other code optimizations. This type of data is also incompatible with many Simulink and Stateflow features.

For example, the following features do not support machine-parented data:

To make Stateflow data accessible to other charts and blocks in a model, use data store memory. For details, see Sharing Global Data with Multiple Charts.

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS