Scope and hierarchy of variables in Simulink

2 ビュー (過去 30 日間)
Tim Hattrell
Tim Hattrell 2022 年 9 月 20 日
コメント済み: Tim Hattrell 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 件)

カテゴリ

Find more on Subsystems in Help Center and File Exchange

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by