Updating line connection in Simulink
7 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to update the connection of a line/signal in Simulink programatically. So fat I was able to retrieve the line information using
h = get_param('some_system/some_block','PortHandles');
ln = get_param(h.LConn, 'Line');
After that I want to change the source or destination port of the line ln, but I did not find a way to do that.
What I want to achieve in the end is to put a block before/after another Simscape block and make sure that all connections from the chosen port pass through the new block which in also connected to all previously connected blocks. If I have Block_A connected to Block_B and Block_C, I want to inject Block_X between them, so Block_A is only connected to Block_X, while Block_X is connected to Block_A on LConn and to Block_B and Block_C on RConn
0 个评论
回答(1 个)
Jyotsna Talluri
2020-4-21
You can do that by deleting the lines connected from Block_A to Block_B and Block_A to Block_C.Add a new block Block_X.Then add lines connecting from Block_A to Block_X,Block_X to Block_B and Block_X to Block_C.You can make use of delete_line,add_block and add_line functions respectively for the above operations
Refer to the below documentation links to know more about the functions:
另请参阅
类别
在 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!