Updating line connection in Simulink
7 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Jyotsna Talluri
on 21 Apr 2020
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:
See Also
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!