Linking simulink blocks using code
3 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a simulink diagram that uses a duplicated simulink blocks. Is there a solution not to link these blocks manually? Is there a way to link blocks using matlab code?
Thx,
0 个评论
采纳的回答
Thomas Jensen
2021-4-14
Hi Yessine,
Yes, you can do it by script:
1- Get the port handle of both blocks
portHandles1 = get_param('model/block1','PortHandles');
portHandles2 = get_param('model/block2','PortHandles');
2- Add a line connecting the outport of one block to the outport of the other block
add_line('model',portHandles1.Outport,portHandles2.Inport);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Physical Units 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!