Write Event Actions

You can run computations on events using event actions by:

  • Writing event actions using MATLAB® code that perform computations.

  • Using the Simulink Function block to call a function that performs computations.

With either of these methods, you can use attribute-defined data to perform the computations.

Run Computations on Events

You can write actions for events using MATLAB code or Simulink® functions. Each block that enables you to create actions has an Event Actions tab. The type of event action you can write depends on the block. For example, for the Entity Queue block you can create event actions for:

  • Entity entry to the block

  • Exit from the block

  • Blocked entities

In the actions, entities are available as MATLAB structures, with structure fields representing values of the entity attributes. Reserved fields such as ID and priority are also available as a separate MATLAB structure called entitySys.

When you create an action for the block, a badge appears to indicate that an action exists. One or more badges appear, depending on the action.

Hover over the badge to see what actions exist.

Double-clicking the badge opens the Event actions tab of the block.

As you define an action, an asterisk (*) appears in the Event actions tab.

For more information on defining event actions, see Events and Event Actions.

See Also

| | | | |

Related Examples

More About