Connect two simulink lines programatically
9 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a need to remove all goto-from block pair (requirement for some project) and perform the connections with lines.
I can make a script that removes all goto-from blocks and I can basically track source for each goto and destination for each from which I can thn connect with add_line, but this appreach is awkward and has certain implementation problems (immagine from block that feeds some things one of which is some other goto block).
What I ould like to do is programatically connect the lines that connect from and to those goto-from pairs. i.e. I remove the blocks with delete_block and then would like to connect the wires that were previously connected to each pair. add_line doesn't seem to accept line handles as argument. So the question is:
How do I programatically connect to simulink lines?
0 件のコメント
回答 (1 件)
Fangjun Jiang
2020 年 6 月 17 日
%%
Model='ex_goto_tag_visibility_block';
open_system(Model);
Block=[Model,'/GotoGlobal'];
PC=get_param(Block,'PortConnectivity');
P1=PC(1).Position;
delete_block(Block);
Block=[Model,'/From'];
PC=get_param(Block,'PortConnectivity');
P2=PC(1).Position;
delete_block(Block);
add_line(Model,[P1;P2])
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!