Main Content

Truth Table Function

R2026b

Truth table in Stateflow chart

Description

Use a truth table function to model combinatorial logic in a Stateflow chart. A truth table function evaluates a set of conditions and executes an action based on the combination of condition outcomes. To program the function, double-click the function box to open the truth table editor and add conditions, decisions, and actions.

Truth table functions are not supported in standalone Stateflow charts in MATLAB.

To add a truth table function to a Stateflow chart:

  1. In the object palettes, click the Truth table icon The truth table icon..

  2. Click a location in the chart canvas.

  3. Enter the function signature.

Properties

expand all

To edit graphical object properties interactively, right-click the object and select Properties.

To modify truth table function properties programmatically, use Stateflow.TruthTable objects.

Content

Name of the truth table function. This property is read-only. Click the hyperlink to navigate to the truth table function in the Stateflow® Editor. To change the name, edit the Label property.

Inlining behavior of the function in generated code, specified as one of these values:

  • Auto determines whether to inline the function based on an internal calculation.

  • Inline inlines the function when it is not exported to other charts and not part of a recursion.

  • Function does not inline the function.

Signature for the truth table function. The signature is the function name and the formal names for its arguments and return values. Changing the label updates the function name in the Name property.

Whether to generate an error or warning if the truth table is underspecified, specified as Error, Warning, or None.

Whether to generate an error or warning if the truth table is overspecified, specified as Error, Warning, or None.

Action language for the truth table function, specified as MATLAB or C. This property is available only in charts that use C as the action language.

Version History

Introduced before R2006a