Skip to Main Content Skip to Search
Product Documentation

Language Options for Stateflow Truth Tables

Stateflow Classic Truth Tables

Using Stateflow Classic truth tables, you can specify conditions and actions using the Stateflow action language, which supports basic C constructs and provides access to MATLAB functions using the ml namespace operator or ml function. For more information about the Stateflow action language, see Using Actions in Stateflow Charts.

Stateflow Classic mode is the default setting for Stateflow truth tables.

MATLAB Truth Tables

You can specify conditions and actions for MATLAB truth tables by using MATLAB action language, which provides optimizations for code generation.

MATLAB truth tables offer several advantages over Stateflow Classic truth tables:

Selecting a Language for Stateflow Truth Tables

To specify an action language for your Stateflow truth table:

  1. Double-click the truth table to open the Truth Table Editor.

  2. Select Language from the Settings menu.

  3. Select a language from the drop-down menu.

Migration from Stateflow Classic to MATLAB Truth Tables

When you migrate from a Stateflow Classic truth table to a MATLAB truth table, you must verify that the code used to program the actions conforms to MATLAB syntax. Between the two action languages, these differences exist.

For this type of action language...Indices are...And the expression for not equal to is...
MATLABOne-based~=
StateflowZero-based!=

You can check for syntax errors by using the Run Diagnostics command in the Truth Table Editor, as described in Checking Truth Tables for Errors.

  


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