MATLAB: How to break links for only blocks from user libraries in Simulink 6.6 (R2007a)

simulink

I can use the SAVE_SYSTEM command with the 'BreakLinks' option to break links for blocks from all libraries. However, I would like to be able to only break links for blocks from user libraries.

Best Answer

The ability to programmatically break links for only blocks from user libraries is not available in Simulink 6.6 (R2007a).
To work around this issue, show which blocks have links to user libraries and the break the links manually:
1. Save a new copy of the model, if desired.
2. Select Format -> Library Link Display -> User. After selecting this option, all blocks linked to user libraries will have an arrow icon in the lower left-hand corner.
3. For each block with the arrow icon in the corner, right click on the block and select Link Options -> Disable Link. The icon should turn gray.
4. Right click on the block again and select Link Options -> Break Link. The icon should be removed.
Starting in Simulink 7.0 (R2007b) this can be accomplished programmatically by executing the command:
save_system('sys', 'newname', 'BreakUserLinks', true)