How run Simulink model automatically from itself if a condition is met?
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ester Panea Murillo
am 5 Jun. 2020
Kommentiert: Ester Panea Murillo
am 5 Jun. 2020
I need to run simulink twice automatically only after the first run (this is because I need the data from the first simulation in order to feed the next one - this already works in my model by an InitFCN code).
I tried implementing the next code in StopFCN callback, but obviously it doesn't work because "Termination of 'model_name' is in progress"
%no. runs counter
Number_Runs=Number_Runs+1
%only if number of run times is 2 automatically run simulink
if (Number_Runs - 1)==0
sim(SIMULINK_MODEL_L7); %%HERE IS WHERE I TRIED TO RUN BY CODE
end
I can't come across any solution to implement this.
Hope I explained well.
-Ester
0 Kommentare
Akzeptierte Antwort
Fangjun Jiang
am 5 Jun. 2020
Bearbeitet: Fangjun Jiang
am 5 Jun. 2020
Try it in PostSaveFcn, or have an independent and separate M-script to control your simulation.
3 Kommentare
Fangjun Jiang
am 5 Jun. 2020
Might it be just a simple syntax error, like
open_system('f14');
sim('f14')
or you could do
model='f14'
sim(model)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Model, Block, and Port Callbacks 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!