Create siumlink model using script.
Show older comments
I am trying to build a script that will create a simulink model taking the input block data from excel.
However facing difficulty in addressing the created block. i have read my data using code
%Read from Excel and open a simulink block
[~, signal] = xlsread('Com Simu mAPPNG.xlsx')
new_system('test');
open_system('test')
count= size(signal,1);
% create bus with number oif input as count.
add_block('simulink/Commonly Used Blocks/Bus Creator', 'test/BC1');
set_param('test/BC1','Inputs','count');
This works fine. When i enter the loop to create blocks names from the data read from excel (create memory read blocks).
or x=1:count
add_block('simulink/Signal Routing/Data Store Read', 'test/MemoryRead1', 'MakeNameUnique', 'on');
set_param(gcb,'Name', signal{x,1});
set_param(gcb,'Datastorename', signal{x,1});
This also works.
Now i want to add line. and to address the block
add_line('test','signal{x,1}/1','BC1/x');
Gives error
Invalid Simulink object name: signal{x,1}/1
Pls help how to address these variable.
Accepted Answer
More Answers (0)
Categories
Find more on Event Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!