Scope and hierarchy of variables in Simulink
2 次查看(过去 30 天)
显示 更早的评论
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 Center 和 File Exchange 中查找有关 Subsystems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!