Removing a block and making connections
古いコメントを表示
Lets say I have a simple subsystem that is just an inport, an outport and a gain block. I want to get rid of the gain block and just have the inport connected to the outport. If i use replace_block I can only replace the gain with another block and if I use delete_block it will remove the gain but leave two disconnected lines. How can I remove this block and make the connection between the remaining two using code?
採用された回答
その他の回答 (1 件)
chandu
2014 年 12 月 8 日
0 投票
May I know how to disconnect SimPowerSystems blocks using PortHandles? Please help me ASAP.....
1 件のコメント
Marco Baratelli
2016 年 1 月 22 日
The following works for me using SimScape! Hope it helps.
sbh = getSimulinkBlockHandle([sys '/NameOfYourSpecificBlock']);
ph = get_param(sbh,'PortHandles');
srcSignal = get_param(ph.RConn,'Line'); % or LConn for left connection of the block
delete_line(srcSignal);
カテゴリ
ヘルプ センター および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!