MATLAB: Are the referenced subsystems from libraries not remaining locked

simulink

I put a referenced subsystem block in a library and lock the library. When I use this block in a Simulink model, the subsystem block is not locked and is editable from the model. Why is this, and how can I make sure that the subsystem remains locked in our model?

Best Answer

This seems to be the expected behavior for this block. It says "When you drag a subsystem reference or model reference from a library into a model, it directly references the subsystem file or model file that defines its contents.": 
There are a couple of work-arounds for this that would keep the original subsystems as individual models, while also keeping them locked when they are used in other models. The first thing you can do is in the library blocks, place the referenced subsystem block in an additional subsystem block. This subsystem block and the referenced subsystem will remain locked when brought into the model.
Another option is to make nested libraries. It this scenario, your original subsystem models would instead be libraries. These library blocks will could then be placed into a larger library that holds many of these other libraries which used to be subsystems. In this way, if either the original or the top-level library are locked, it will be locked in the model its linked to.