Function Element
Libraries:
Simulink /
Ports & Subsystems
Description
A Function Element block specifies which port-scoped Simulink® function in a model is made available through an exporting function port. Use Function Element blocks when you want a function defined inside a referenced model to be callable from other models.
For example, the Function Element block labeled
SrvPort.f specifies that the Simulink function, f, is accessible through the exporting
function port, SrvPort.

Export Simulink Functions Using Function Element Blocks
When you place a Function Element block at the root level of a referenced model, the corresponding Model block displays an exporting function port. An exporting function port is a port on a Model block that provides access to the function inside the referenced model.
For example, the Model block displays an exporting function port labeled
SrvPort.

Note
A Function Element block must be placed at the root level of an export-function model. Each Function Element block must correspond to a port-scoped Simulink Function block at the root level, which defines the function associated with the exporting function port.
Connecting this exporting function port to an invoking function port of another Model block enables a function caller in that model to call the function and receive return values. For more information, see the Function Element Call block.
When to Use Function Element Blocks
Use Function Element blocks when:
You need a model to provide a function that other models can call.
You want to reuse function definitions across multiple models.
You have export-function models that require asynchronous function calls across model boundaries.
Examples
Ports
Input
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Tips
Use the Filter box to specify a search term to use for filtering a long list of function elements. Do not enclose the search term in quotation marks. The filter does a partial string search and supports regular expressions. To use a regular expression character as a literal, include an escape character (
\). For example, to use a question mark, typefcn\?1. For more information, see Regular Expressions.To change the background color of a Function Element block, click
and select a standard color or specify a
custom color. Alternatively, use the BackgroundColorblock property. For more information, see Programmatically Specify Block Parameters and Properties.

