Delete Specific Simulink Block in a Linked Subsystem using m-script (MATLAB)

9 visualizaciones (últimos 30 días)
How can I delete a specific block (eg: ShiftArith) in a linked subsystem programmatically using MATLAB? I have the block path for the block and I'm using "delete_block" command to delete the block. But I get the following error when executed.
delete_block(blkpath) Attempt to modify block in a linked subsystem. This can only be done by the block or its parent through their mask initialization code
Any methods to delete the block throughout the linked model.
Thanks.

Respuestas (1)

Mark McBroom
Mark McBroom el 27 de Feb. de 2022
You have 2 options.
  1. if you want to delete the block for all instances of the subsystem, the you should open the simulink library and use the path to the block from within the simulink library to delete the block.
  2. If you want to delete the block only for one instance of the subsystem, you will have to first break the link to the library before Simulink will let you delete the block.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by