Unable to add block in Simulink 2016 with add_block command

1 view (last 30 days)
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');

Accepted Answer

stozaki
stozaki on 31 Jul 2020
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

More Answers (0)

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!