필터 지우기
필터 지우기

add_line for single source and multiple destination

조회 수: 13 (최근 30일)
Shankar Santhosh
Shankar Santhosh 2020년 8월 10일
답변: Monisha Nalluru 2020년 8월 13일
Looking for any simple way to add a line programmatically from output of a block(say Constant block) to more than one destination blocks(Eg., OutPort and Scope).
I Expect something like,
Any suggestions?

답변 (1개)

Monisha Nalluru
Monisha Nalluru 2020년 8월 13일
add_line function is used to connect the signal between block.
To add a line programmatically from output of a block to more than one destination blocks you can below code as example
open_system(new_system('connect_model'));
add_block('simulink/Commonly Used Blocks/Constant','connect_model/Constant');
set_param('connect_model/Constant','position',[220,80,295,120]);
add_block('simulink/Sinks/Out1','connect_model/Out1');
set_param('connect_model/Out1','position',[220,80,260,120]);
add_block('simulink/Sinks/Scope','connect_model/Scope');
set_param('connect_model/Scope','position',[235,162,280,218]);
add_line('connect_model','Constant/x','Out1/4');
add_line('connect_model','Constant/x','Scope/1');
Customize code according to add more blocks and signals between blocks.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by