- Use Mask initialization and storing the mask parameters:
- Restore Mask Parameters: After running Simulink.BlockDiagram.refreshBlocks(), use a post-refresh callback to retrieve the stored mask parameters and reapply them to the updated instances of the referenced subsystem blocks.
- Associating User Data with Blocks: https://www.mathworks.com/help/simulink/ug/associating-user-data-with-blocks.html
- find_system: https://www.mathworks.com/help/simulink/slref/find_system.html#bu32w05-2