How do I call Simulink function in nested subsystem?

조회 수: 5 (최근 30일)
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?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2023년 5월 4일
편집: MathWorks Support Team 2023년 5월 4일
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:
  1. Outside the subsystem one hierarchic level above the function
  2. In another subsystem at the same hierarchic level as the function
  3. In another subsystem one or more levels below the hierarchic level of the function
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개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by