Main Content

receiveEvent

Receive event from scenario

Since R2023a

    Description

    eventStruct = receiveEvent(actorSim,"UserDefinedEvent",eventName) listens for and returns event structure corresponding to received user-defined event eventName for actor actorSim.

    example

    Examples

    collapse all

    Receive user-defined event TriggerOvertake from a scenario.

    receiveEvent(actorWhiteSedan,"UserDefinedEvent","TriggerOvertake")

    Input Arguments

    collapse all

    Actor that receives an event, specified as an ActorSimulation object.

    Name of user-defined event received from a scenario, specified as a string scalar or character vector. The user-defined event must be defined and added to the interface of a MATLAB® System object™ actor model through the getInterfaceImpl (Simulink) function.

    Output Arguments

    collapse all

    User-defined event from a scenario, returned as a struct.

    Field NameDescription
    LogicEventInformation about the specified user-defined event, returned as a struct.
    NameName of the user-defined event, returned as a string.
    ParametersParameters of the user-defined event, returned as a struct. This structure contains the name and value of each custom parameter.

    This table describes the LogicEvent structure.

    Field NameDescription
    EventType

    Type of event, returned as an enumeration variable. The value of the variable can be:

    • UserDefined — User-defined event type.

    PublishType

    Method of publishing, returned as an enumeration variable. The value of the variable can be:

    • Broadcast — User-defined event sent from an actor is broadcast to all other actors in a scenario.

    Version History

    Introduced in R2023a