Clear Filters
Clear Filters

generate a simulink model using For loop.

1 view (last 30 days)
hey, I'm facing a new probleme in the generation of Simulink Model using Matlab script.
i will explaine my probleme with exemple.
i want to generate a variable Numbre of MinMax blocks and a variable of Numbre of it's Inputs.
so to do all that i have to use For loop with the command add_block and set_param. but the probleme is I can't use a variable inside of set_param .
an athore probleme i face is that when i run my script the nams of blocks don't change with the (i) variable of For loop. it just gives the name with a small tile at the end .
Thank you .
mattt.PNG
for j=1:b1
b(i)=(b1/2);
if b(i)~=1
v9=32;v10=63;
for i=1:b(i)
pos7=[v11,v7,v12,v8];
add_block('simulink/Math Operations/MinMax',[sys ['/2min',i]],'MakeNameUnique', 'on','Position',pos7);
set_param(['ldpc/2min',i],'Inputs','2');% is there a way to use a variable in these command to define the numbre of inputs
v9=v9+85;v10=v10+85;
end
else
add_block('simulink/Math Operations/MinMax',[sys '/3min'],'MakeNameUnique', 'on','Position',[v11,32,v12,63]);
set_param('ldpc/3min','Inputs','2');
end
v11=v11+180; v12=v12+180;
end

Answers (0)

Categories

Find more on Simulink Coder 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!