When Simulink handles blocks inside masked subsystems, ports on blocks might inadvertently be disconnected, which causes errors in the design.
For example, suppose a design containing a masked subsystem is opened and simulated without first opening the subsystem. Simulink will lose track of the port lists for blocks within the subsystem; as a result, nets will detach from the ports.
You can avoid this problem simply by opening the subsystem by hand (i.e., by double-clicking with the mouse) before simulating.
Another approach is to open the subsystem automatically by setting the PostLoadFcn for the model to:
where "my_model" is the name of the model, and "foo/bar" is the subsystem having the problem.
A model containing several masked subsystems requires an open_system() for each:
open_system('my_model/ss1', 'force'); open_system('my_model/ss2', 'force');
The PostLoadFcn can be set from the MATLAB command prompt by executing a command similar to the following:
>> set_param('my_model', 'PostLoadFcn', 'open_system(''my_model/ss1'', 'force'');' )
(NOTE: Each double quotation mark in the above is actually two single quotation marks in a row.)