Auto-connect block to existing line
古いコメントを表示
I want to add in some data type conversion blocks infront of some already existing inport blocks. I can create the block and add them to the model and they appear on the port line where I expect them, but they do not connect to that line. They appear above the line and I have to drag them to get them attached to the line. So I was wondering if there was any way I could connect the new block to the line that’s already there from the command line.
採用された回答
その他の回答 (1 件)
Azzi Abdelmalek
2012 年 9 月 4 日
編集済み: Azzi Abdelmalek
2012 年 9 月 4 日
% the line fom you want connect to your new block "new_block" is an output for a certain block "block1"
%for example new_block is a "constant" block and modelname is the name of your simulink model
add_blck('Simulink/Sources','modelname/new_block')
% to position your block
set_param('modelname/new_block','position' , [x0 y0 x0+x_width y0+y_width])
%connect block
add_line('modelname','block1/1','new_block/1','autorouting','on')
% 'block1/n' means n'th output of block1
% 'new_block/n' means n'th input of new_block
カテゴリ
ヘルプ センター および File Exchange で Programmatic Model Editing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!