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

12 ビュー (過去 30 日間)
Allan Anbu
Allan Anbu 2022 年 2 月 23 日
回答済み: Mark McBroom 2022 年 2 月 27 日
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.

回答 (1 件)

Mark McBroom
Mark McBroom 2022 年 2 月 27 日
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.

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by