Saving/Loading the SimState Programmatically
Show older comments
I have a problem with saving/loading SimState programmatically. It works when i do it manually in the Simulink settings, but when doing it in a m file i get an error. My code is simply
simfile = 'simfile';
set_param(simfile, 'SaveFinalState', 'on', 'FinalStateName','SimState','SaveCompleteFinalSimState', 'on');
set_param(simfile, 'LoadInitialState', 'off');
simOut = sim(simfile,'StopTime',num2str(10));
set_param(simfile, 'SaveFinalState', 'off');
set_param(simfile, 'LoadInitialState', 'on', 'InitialState','SimState');
simOut = sim(simfile,'StopTime',num2str(20));
resulting in an error
??? Error using ==> simtest at 10
Error evaluating expression 'SimState' for 'Initial state' specified in the Configuration Parameters dialog for block diagram 'simfile': Undefined function or variable
'SimState'.
What am i missing?
Thanks :)
Benjamin
Accepted Answer
More Answers (1)
Ronald Verhoeven
on 26 Feb 2011
0 votes
I have exactly the same problem. I didn't get the answer yet. Who could help me solving the above posted question? Thank you.
Categories
Find more on Large Files and Big Data 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!