Adding Function Call Outputs to a MATLAB Function Block

A function call output is an event on the output port of a MATLAB Function block that causes a Function-Call Subsystem block in the Simulink® model to execute. Another block can invoke a function-call subsystem directly during a simulation. See Using Function-Call Subsystems.

Use the Ports and Data Manager to add and modify function call outputs to a MATLAB Function block that is open and has focus. To add a function call output and modify its properties, follow these steps:

  1. In the Ports and Data Manager, select Add > Function Call Output.

    The Ports and Data Manager adds a default definition of the new function call output to the MATLAB Function block and displays the Function Call properties dialog.

  2. Modify function call output properties.

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

Considerations when Supplying Output to the Function-Call Subsystem

If a MATLAB Function block triggers a function-call subsystem, and supplies an output signal to the same function-call subsystem, the signal to the function-call subsystem can effectively be delayed by one time step compared to the function call. At the moment of the function call, the function-call subsystem sees the previous MATLAB Function block output port value even if the output data has been updated within the block MATLAB® code.

The Function Call Properties Dialog

The Function Call properties dialog in the Ports and Data Manager allows you to edit the properties of function call outputs in MATLAB Function blocks.

To open the Function Call properties dialog, select a function call output in the Contents pane.

Setting Function Call Output Properties

You can set the following properties in the Function Call properties dialog:

NameName of the function call output, following the same naming conventions used in MATLAB.
PortIndex of the port associated with the function call output. Function call output ports are numbered sequentially after input and output ports.
DescriptionDescription of the function call output.
Document linkLink to documentation for the function call output. 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 Document link displayed at the bottom of the Function Call properties dialog, the MATLAB Function block evaluates the link and displays the documentation.

Related Examples

More About