Main Content

Adding Input Triggers to a MATLAB Function Block

An input trigger is an event on the input port that causes the MATLAB Function block to execute. See Using Triggered Subsystems.

You can define the following types of triggers in MATLAB Function blocks:

  • Rising

  • Falling

  • Either (rising or falling)

  • Function call

For a description of each trigger type, see Setting Input Trigger Properties.

Use the Ports and Data Manager to add input triggers to a MATLAB Function block that is open and has focus. To add an input trigger and modify its properties, follow these steps:

  1. In the Ports and Data Manager, select Add > Input Trigger.

    The Ports and Data Manager adds a default definition of the new input trigger to the MATLAB Function block and displays the Trigger properties dialog.

  2. Modify trigger properties.

  3. Return to the MATLAB Function block properties at any time by selecting Tools > Block Dialog.

The Trigger Properties Dialog

The Trigger properties dialog in the Ports and Data Manager allows you to set and modify the properties of input triggers in MATLAB Function blocks.

To open the Trigger properties dialog, select an input trigger in the Contents pane.

Setting Input Trigger Properties

You can set the following properties in the Trigger properties dialog:

PropertyDescription
NameName of the input trigger, following the same naming conventions used in MATLAB®.
PortIndex of the port associated with the input trigger. The default value is 1.
Trigger

Type of event that triggers execution of the MATLAB Function block. You can select one of the following types of triggers:

  • Rising (default) — Triggers execution of the MATLAB Function block when the control signal rises from a negative or zero value to a positive value (or zero if the initial value is negative).

  • Falling— Triggers execution of the MATLAB Function block when the control signal falls from a positive or zero value to a negative value (or zero if the initial value is positive).

  • Either— Triggers execution of the MATLAB Function block when the control signal is either rising or falling.

  • Function call— Triggers execution of the MATLAB Function block from a block that outputs function-call events, or from an S-function

DescriptionDescription of the input trigger.
Document linkLink to documentation for the input trigger. You can enter a Web URL address or a MATLAB command that displays documentation in a suitable format, such as an HTML file or text in the MATLAB Command Window. When you click the blue text that reads Document link displayed at the bottom of the Trigger properties dialog, the MATLAB Function block evaluates the link and displays the documentation.

Related Examples

More About