How does the function element and function element call block work?

2 views (last 30 days)
I want to call a function which is in an subsystem from outside that subsystem therfore i would like to use the function element and element call block but i dont really understand from the documentation how i have to setup the port name since the function element block never seems to see the function.
Thank you very much

Accepted Answer

Raj
Raj on 16 Nov 2023
Hello Svenh,
In Simulink, the Function Element and Element Call blocks are not used for calling functions within subsystems. The Function Element block lets you call a Simulink function from one referenced model using a function caller in another referenced model.
To call a function that resides in a subsystem from outside the subsystem in Simulink, you can follow these steps:
  1. Inside the subsystem, add Inport and Outport blocks to represent the function inputs and outputs and connect the necessary signals to it.
  2. Place Inport blocks outside the subsystem for function inputs and connect them to the corresponding Inport blocks inside the subsystem.
  3. Place Outport blocks outside the subsystem for function outputs and connect them to the corresponding Outport blocks inside the subsystem.
With this, you can call the function defined in the subsystem from outside the subsystem. The Inport blocks represent the function inputs, and the Outport blocks represent the function outputs.
Additionally you can refer to the documentation for a better understanding-
I hope this resolves your query!

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!