Linking simulink blocks using code
조회 수: 2 (최근 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에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!