How do I recover Simulink outputs after error?
Ältere Kommentare anzeigen
I have a Simulink model that contains a bunch of ToWorkspace blocks. I call the simulation using
SimOut = sim('MySim')
If I have a runtime error (or just press ctrl+C) and the simulation stops due to an error, is there a way to recover the data that would exist in SimOut for the portion of the simulation that did run?
For example, if I start a simulation that runs for 10min and it has an error at 9min, can I get the first 9min of the simulated data?
Akzeptierte Antwort
Weitere Antworten (1)
Amir
am 1 Aug. 2025
0 Stimmen
Bit late, but you can always run via set_param('EkmcuControlledModularPlant', 'SimulationCommand', 'start');
I wanted to access logsout which, when running via out = sim(bdroot) would be in out.logsout.
If you run using the set_param, it will be simply in logsout. One thing to pay attention to is , that this is indeed equivalent (or atleast similar) to pressing Run, and in that sense, if you use this in for loop or something, it will not wait for the simulation to be finished.
Kategorien
Mehr zu Simulink finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!