Main Content

Stateflow.Event

Event in chart, state, or box

    Description

    Use Stateflow.Event objects to trigger actions in one of these objects:

    • A parallel state in a Stateflow® chart

    • Another Stateflow chart

    • A Simulink® triggered or function-call subsystem

    For more information, see Synchronize Model Components by Broadcasting Events.

    Creation

    Description

    event = Stateflow.Event(parent) creates a Stateflow.Event object in a parent chart, state, or box.

    example

    Input Arguments

    expand all

    Parent for the new event, specified as a Stateflow API object of one of these types:

    Properties

    expand all

    Stateflow API objects have properties that correspond to the values you set in the Stateflow Editor. To access or modify a property, use dot notation. To access or modify multiple properties for multiple API objects, use the get and set functions, respectively. For more information, see Modify Properties and Call Functions of Stateflow Objects.

    Interface

    Name of the event, specified as a string scalar or character vector.

    Scope of the event, specified as "Local", "Input", or "Output". For more information, see Scope.

    Type of trigger associated with the event, specified as a string scalar or character vector that depends on the scope of the data:

    • For input events, use "Function call", "Rising", "Falling", or "Either".

    • For output events, use "Function call" or "Either".

    This property does not apply to local events. For more information, see Trigger.

    Port index for the event, specified as an integer scalar. This property applies only to input and output events. For more information, see Port.

    Debugging

    Debugger properties for the event, specified as a Stateflow.EventDebug object with these properties:

    • Breakpoints.StartBroadcast — Whether to set the Start of Broadcast breakpoint, specified as a numeric or logical 1 (true) or 0 (false).

    • Breakpoints.EndBroadcast — Whether to set the End of Broadcast breakpoint, specified as a numeric or logical 1 (true) or 0 (false).

    For more information, see Set Breakpoints to Debug Charts.

    Example: event.Debug.Breakpoints.StartBroadcast = true;

    Example: event.Debug.Breakpoints.EndBroadcast = true;

    Hierarchy

    This property is read-only.

    Machine that contains the event, specified as a Stateflow.Machine object.

    This property is read-only.

    Location of the parent of the event in the model hierarchy, specified as a character vector.

    Identification

    Description for the event, specified as a string scalar or character vector.

    Document link for the event, specified as a string scalar or character vector.

    User-defined tag for the event, specified as data of any type.

    This property is read-only.

    Unique identifier, specified as an integer scalar. Use this property to distinguish the event 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

    getParentIdentify parent of object
    getReferencesIdentify references to symbol name
    renameReferencesRename symbol and update references to symbol name
    dialogOpen properties dialog box
    viewDisplay object in editing environment

    Examples

    collapse all

    Add an event to the chart ch. Specify its name and scope.

    event = Stateflow.Event(ch);
    event.Name = "E";
    event.Scope = "Input";

    Version History

    Introduced before R2006a

    expand all