Unable to add block in Simulink 2016 with add_block command

1 次查看(过去 30 天)
Hi , I'm getting an error when i try to add_block in 2016 MATLAB version with the command listed below
sys = 'Test';
new_system(sys) % Create the model
open_system(sys) % Open the model
% Start adding blocks; for each one the position has to be specified
add_block('built-in/SubSystem',[sys '/xyz'],'Position',[240 95 270 125]);
add_block('built-in/Inport', [sys '/xyz' '/IN1'],'Position',[240 95 270 125]);
add_block('built-in/Inport', ['/Test' '/IN1'],'Position',[140 95 170 125]);
add_line('Test','IN1/1','xyz/1', 'autorouting','on');

采纳的回答

stozaki
stozaki 2020-7-31
Hello Ruhi,
Please try to edit line 7 as follows :
Before :
add_block('built-in/Inport', ['/Test' '/IN1'],'Position',[140 95 170 125]);
After :
add_block('built-in/Inport', ['Test' '/IN1'],'Position',[140 95 170 125]);
or
add_block('built-in/Inport', [sys '/IN1'],'Position',[140 95 170 125]);
Regards,
stozaki

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Inputs 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by