I use Simulink.Bus objects to define bus interface between Simulink blocks. This worked well, but now I ran into the following problem:
I created the Simulink.Bus objects only in the base workspace.
After I created a mask for a block, I get the following error message when I run the model:
The symbol 'xyz' resolved to a bus object in the mask of 'abc/def'. Bus objects should only be created in the base workspace or a data dictionary. If this object is being passed as a mask parameter, turn off evaluation of that parameter using the mask editor. Additionally, bus objects may only resolve through one level of subsystem masks
So, I think I did right by craeting the Bus object only in the base workspace, but somehow a copy was created in the mask workspace.
I inspected the variables in the mask workspace:
p = Simulink.Mask.get('abc/def')
vars = p.getWorkspaceVariables
And indeed, I found that the mask workspace does contain a copy of the Bus object from the base workspace.
How can I make sure that the masked subsystem block references the Bus object from the base workspace instead of creating a copy and Simulink complaining afterwards? What is the right way to achieve this?