MATLAB: Is it possible to create a library like the Simulink library, in which the block links are broken automatically

acreatelibrary

Is it possible to create a library like the Simulink library, in which the block links are broken automatically?
I would like to create a library and have an option which would still have the library locked, but when the blocks were copied to a model, they were not linked to the library. This is the same behavior that the Simulink library has.

Best Answer

Currently, if you create a library, the blocks that you copy will be linked to that library, and you will have to explicitly break them, either using the mouse or by the save_system command. Type help save_system for the syntax.
The other option would be to create a model instead of a library. Blocks copied from the model would not be linked to one another. This is how the Simulink library was implemented in versions prior to 2.1. The drawback to this is that the model would not be locked to changes as in libraries.
Alternately, if you want to have links broken by default you'll need to set each block's copy function to break the link. You can use the following command to do this:
set_param('libname/blockname','Copyfcn','set_param(gcb,''LinkStatus'',''none'')')
You'll need to replace libname and blockname with the library and blockname you're working with.
You could also use a model to store your blocks instead of a library.