Main Content

Stateflow.StateTransitionTableChart

Tabular representation of state machine for modal logic

    Description

    Use a Stateflow.StateTransitionTableChart object to create a tabular representation of a finite state machine for modal logic. The benefits of using state transition tables include:

    • The ease of modeling train-like state machines, where the modal logic involves transitions from one state to its neighbor

    • A concise, compact format for a state machine

    • Reduced maintenance of graphical objects

    For more information, see State Transition Tables in Stateflow.

    Creation

    To create a Stateflow.StateTransitionTableChart object, call the function sfnew with the -STT argument. For example, to create a State Transition Table block in a new Simulink® model called myModel, enter:

    sfnew -STT myModel

    Alternatively, you can add a new State Transition Table block to an existing model by using the function add_block (Simulink):

    add_block('sflib/State Transition Table','myModel/State Transition Table')

    Then, to access the Stateflow.StateTransitionTableChart object, call the find function for the Simulink.Root object:

    rt = sfroot;
    table = find(rt,'-isa','Stateflow.StateTransitionTableChart', ...
        'Path','myModel/State Transition Table');

    Properties

    expand all

    Content

    Name of the state transition table, specified as a character vector.

    Action language used to program the state transition table, specified as 'MATLAB' or 'C'. For more information, see Differences Between MATLAB and C as Action Language Syntax.

    State machine semantics implemented by the state transition table, specified as 'Classic', 'Mealy', or 'Moore'. For more information, see Overview of Mealy and Moore Machines.

    Whether the state transition table supports variable-size data, specified as a numeric or logical 1 (true) or 0 (false). Only variable-size data can change dimension during simulation. For more information, see Declare Variable-Size Data in Stateflow Charts.

    Chart Initialization

    Whether to initialize the state configuration of the state transition table at time zero instead of at the first input event, specified as a numeric or logical 1 (true) or 0 (false). For more information, see Execution of a Chart at Initialization.

    Behavior of the states when a function-call input event reenables the state transition table, specified as one of these values:

    • '' — The state transition table does not contain function-call input events.

    • 'held' — The state transition table maintains the most recent values of the states.

    • 'reset' — The state transition table reverts to the initial conditions of the states.

    For more information, see Control States in Charts Enabled by Function-Call Input Events.

    Whether to initialize the output data every time the state transition table wakes up, specified as a numeric or logical 1 (true) or 0 (false). For more information, see Initialize outputs every time chart wakes up.

    Active State Output

    Whether to create an active state data output port for the state transition table, specified as a numeric or logical 1 (true) or 0 (false). For more information, see Monitor State Activity Through Active State Data.

    This property is read-only.

    Active state data object for the state transition table, specified as a Stateflow.Data object. This property applies only when the HasOutputData property for the state transition table is true.

    Name of the active state data object for the state transition table, specified as a character vector. This property applies only when the HasOutputData property for the state transition table is true.

    Monitoring mode for the active state output data, specified as 'ChildActivity' or 'LeafStateActivity'.

    Name of the enumerated data type for the active state data object for the state transition table, specified as a character vector. For more information, see Enum Name.

    Whether to define the enumerated data type for the active state data output manually, specified as a numeric or logical 1 (true) or 0 (false). For more information, see Define State Activity Enumeration Type.

    Discrete and Continuous-Time Semantics

    Activation method for the state transition table, specified as 'CONTINUOUS', 'DISCRETE', or 'INHERITED'. For more information, see Update Method.

    Sample time for activating the state transition table, specified as a character vector. This property applies only when the ChartUpdate property for the state transition table is 'DISCRETE'.

    Whether to enable zero-crossing detection on state transitions in the state transition table, specified as a numeric or logical 1 (true) or 0 (false). This property applies only when the ChartUpdate property for the state transition table is set to 'CONTINUOUS'. For more information, see Disable Zero-Crossing Detection.

    Super Step Semantics

    Whether to enable super step semantics for the state transition table, specified as a numeric or logical 1 (true) or 0 (false). For more information, see Super Step Semantics.

    Maximum number of transitions the state transition table can take in one super step, specified as an integer scalar. This property applies only when the EnableNonTerminalStates property for the state transition table is true.

    Behavior if a super step for the state transition table exceeds the maximum number of transitions specified in the NonTerminalMaxCounts property before reaching a stable state, specified as one of these values:

    • 'Proceed' — The state transition table goes to sleep with the last active state configuration.

    • 'Throw Error' — The state transition table generates an error.

    This property applies only when the EnableNonTerminalStates property for the state transition table is true.

    Integer and Fixed-Point Data

    Whether the data in the state transition table saturates on integer overflow, specified as a numeric or logical 1 (true) or 0 (false). When this property is disabled, the data in the state transition table wraps on integer overflow. For more information, see Handle Integer Overflow for Chart Data.

    Inherited Simulink signals to treat as Fixed-Point Designer™ fi objects, specified as one of these values:

    • 'Fixed-point' — The state transition table treats all fixed-point inputs as fi objects.

    • 'Fixed-point & Integer' — The state transition table treats all fixed-point and integer inputs as fi objects.

    This property applies only when the ActionLanguage property of the state transition table is 'MATLAB'.

    Default fimath properties for the state transition table, specified as one of these values:

    • 'Same as MATLAB Default' — Use the same fimath properties as the current default fimath object.

    • 'Other:UserSpecified' — Use the InputFimath property to specify the default fimath object.

    This property applies only when the ActionLanguage property of the state transition table is 'MATLAB'.

    Default fimath object, specified as a character vector. When the EmlDefaultFimath property for the state transition table is 'Other:UserSpecified', you can use this property to:

    • Enter an expression that constructs a fimath object.

    • Enter the variable name for a fimath object in the MATLAB® or model workspace.

    This property applies only when the ActionLanguage property of the state transition table is 'MATLAB'.

    C Action Language

    Whether to use strong data typing when the state transition table interfaces with Simulink input and output signals, specified as a numeric or logical 1 (true) or 0 (false). This property applies only to state transition tables that use C as the action language. For more information, see Use strong data typing with Simulink I/O.

    Whether to use bit operations in state and transition actions in the state transition table, specified as a numeric or logical 1 (true) or 0 (false). This property applies only to state transition tables that use C as the action language. For more information, see Enable C-bit operations.

    Debugging

    Whether to set the On Chart Entry breakpoint for the state transition table, specified as a numeric or logical 1 (true) or 0 (false).

    Example: table.Debug.Breakpoints.OnEntry = true;

    Graphical Appearance

    This property is read-only.

    Editor for the state transition table, specified as a Stateflow.Editor object. You can use this object to control the position, size, and magnification level of the Stateflow® Editor window.

    Whether the Stateflow Editor window is displaying the state transition table, specified as a numeric or logical 1 (true) or 0 (false).

    Background color for the chart that is automatically generated for the state transition table, specified as a three-element numeric vector of the form [red green blue] that specifies the red, green, and blue values. Each element must be in the range between 0 and 1.

    Color for the boxes, functions, and states in the chart that is automatically generated for the state transition table, specified as a three-element numeric vector of the form [red green blue] that specifies the red, green, and blue values. Each element must be in the range between 0 and 1.

    Color for transitions in the chart that is automatically generated for the state transition table, specified as a three-element numeric vector of the form [red green blue] that specifies the red, green, and blue values. Each element must be in the range between 0 and 1.

    Color for junctions in the chart that is automatically generated for the state transition table, specified as a three-element numeric vector of the form [red green blue] that specifies the red, green, and blue values. Each element must be in the range between 0 and 1.

    Color for the box, function, and state labels in the chart that is automatically generated for the state transition table, specified as a three-element numeric vector of the form [red green blue] that specifies the red, green, and blue values. Each element must be in the range between 0 and 1.

    Font angle for the box, function, and state labels in the chart that is automatically generated for the state transition table, specified as 'NORMAL' or 'ITALIC'.

    Example: table.StateFont.Angle = 'ITALIC';

    Font weight for the box, function, and state labels in the chart that is automatically generated for the state transition table, specified as 'NORMAL' or 'BOLD'.

    Example: table.StateFont.Weight = 'BOLD;

    Initial font size for the annotation, box, function, and state labels in the chart that is automatically generated for the state transition table, specified as a scalar.

    Example: table.StateFont.Size = 8;

    Font name for the annotation, box, function, and state labels in the chart that is automatically generated for the state transition table, specified as a character vector.

    Example: table.StateFont.Name = 'Arial';

    Color for the transition labels in the chart that is automatically generated for the state transition table, specified as a three-element numeric vector of the form [red green blue] that specifies the red, green, and blue values. Each element must be in the range between 0 and 1.

    Font angle for the transition labels in the chart that is automatically generated for the state transition table, specified as 'NORMAL' or 'ITALIC'.

    Example: table.TransitionFont.Angle = 'ITALIC';

    Font weight for the transition labels in the chart that is automatically generated for the state transition table, specified as 'NORMAL' or 'BOLD'.

    Example: table.TransitionFont.Weight = 'BOLD';

    Initial font size for the transition labels in the chart that is automatically generated for the state transition table, specified as a scalar.

    Example: table.TransitionFont.Size = 8;

    Font name for the transition labels in the chart that is automatically generated for the state transition table, specified as a character vector.

    Example: table.TransitionFont.Name = 'Arial';

    Hierarchy

    This property is read-only.

    Machine that contains the state transition table, specified as a Stateflow.Machine object.

    This property is read-only.

    Location of the state transition table in the model hierarchy, specified as a character vector.

    Whether the state transition table has changed after being opened or saved, specified as a numeric or logical 1 (true) or 0 (false).

    Whether the state transition table is locked, specified as a numeric or logical 1 (true) or 0 (false). Enable this property to prevent changes in the state transition table.

    This property is read-only.

    Whether the state transition table is locked, specified as a numeric or logical 1 (true) or 0 (false). This property is equivalent to the property Locked, but is used internally to prevent changes in the state transition table during simulation.

    Identification

    Description for the state transition table, specified as a character vector.

    Document link for the state transition table, specified as a character vector.

    User-defined tag for the state transition table, specified as data of any type.

    This property is read-only.

    Unique identifier, specified as an integer scalar. Use this property to distinguish the state transition table from other objects in the model. The value of this property is reassigned every time you start a new MATLAB session and may be recycled after an object is deleted.

    Object Functions

    classhandleProvide class handle for object
    dialogOpen properties dialog box
    findSpecified objects in hierarchy
    getReturn MATLAB structure containing property settings of object or array of objects
    parseParse single chart or all charts in model
    setSet properties with specified values
    viewDisplay object in editing environment

    Examples

    collapse all

    Call the function sfnew with the -STT argument to open a new Simulink model that contains an empty State Transition Table block.

    sfnew -STT

    Access the Simulink.Root object by calling the sfroot function.

    rt = sfroot;

    Access the Stateflow.StateTransitionTableChart object by calling the find function for the Simulink.Root object.

    table = find(rt,'-isa','Stateflow.StateTransitionTableChart');
    Introduced in R2012b