- Outside the subsystem one hierarchic level above the function
- In another subsystem at the same hierarchic level as the function
- In another subsystem one or more levels below the hierarchic level of the function
How do I call Simulink function in nested subsystem?
5 views (last 30 days)
Show older comments
MathWorks Support Team
on 29 Mar 2017
Edited: MathWorks Support Team
on 4 May 2023
I have a Simulink function 'MyFun' in a subsystem named 'S1' which is a subsystem of 'S2'. I am getting the following error when I call this function from the top level:
ERROR: A definition for the function 'MyFun' called by Function Caller block could not be found.
How can I call the function 'MyFun' from the function caller?
Accepted Answer
MathWorks Support Team
on 4 May 2023
Edited: MathWorks Support Team
on 4 May 2023
This is an expected behavior. As mentioned in the following documentation:
a function caller can be at a level where it can hierarchically resolve to the subsystem containing the function. Hence, we can only call a function from:
Therefore, if the function needs to be accessed at a higher hierarchy, then the function should be moved up so that the caller will be in it's hierarchy.
0 Comments
More Answers (0)
See Also
Categories
Find more on Simulink Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!