Linking simulink blocks using code
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Yessine KAMMOUN
am 14 Apr. 2021
Beantwortet: Thomas Jensen
am 14 Apr. 2021
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 Kommentare
Akzeptierte Antwort
Thomas Jensen
am 14 Apr. 2021
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Physical Units finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!