How to run a simulation with an input array?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Pradeep Annadevara Prabakar
am 10 Jun. 2015
Kommentiert: Pradeep Annadevara Prabakar
am 11 Jun. 2015
Hello Guys,
I have a model with 14 inputs whose values are in an excel sheet. I was able to read the values into a .m file but each input has 11 values (stores as an array). I have to feed the inputs to the model one by one i.e. for simulation1 I need to run the first value in the array of all inputs and then the 2nd value of all the inputs and then run the simulation/store the results. Any help would be appreciated. Thanks in ADV.
0 Kommentare
Antworten (1)
Drew Davis
am 11 Jun. 2015
Use this block in your model. You can create a for loop in a script that iterates over your vector and assigns the value of the vector to the parameter of the block
mdl = 'mymdl'; % name of your model
x = rand(14 , 1); % this represents your data
for i = 1:numel(x)
set_param([mdl '/Constant'] , 'Value' , num2str(x(i))); % set the value of the constant block
simout = sim(mdl); % simulate the model
% do stuff
end
Siehe auch
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!