Scope and hierarchy of variables in Simulink

조회 수: 6 (최근 30일)
men8th . 2022년 9월 20일
댓글: men8th . 2022년 9월 20일
Is there any documentation on variable scope in Simulink. My understanding is that lower level units like masked subsystems have visibility of what I would regard as higher level areas like the model workspace, but the insides of masked subsystems are not visible to global models.
I'm struggling with this a bit because in most programming languages re-usable sub-units have limited scope. For example, a Matlab function would not be able to see the workspace of the calling function, or the Matlab workspace for that matter. On the other hand, a masked Simulink subsystem can see the Simulink workspace.
In the case of conflicts, what takes precidence? For example if I name a mask parameter VAR1 and I also have a variable in the Simulink workspace called VAR1 and a data dictionary entry called VAR1, and a Matlab workspace VAR1, which value is used? (This is the reason I'm asking the question.)
Is there a way to limit the scope of a masked subsystem? For example I see that it is possible to restrict a Simulink model such that it cannot access the Matlab workspace. I can't see similar functionality for masks.
Sorry if this is all obvious. Not easy to search the internet when most hits are related to Simulink scope blocks, ie for viewing signals.

답변 (0개)


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




Community Treasure Hunt

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

Start Hunting!

Translated by