step by step simulation in command line for simulink model
3 次查看(过去 30 天)
显示 更早的评论
Hi I just want some urgent solution for command line implementation for simulink. In simulink model there is simulation switch called "step forward". With this I am able to run step by step and able to see the outputs in scope for each sample time. I am also able to change some inputs for constant input blocks at any sample period time. However, I want to do this in command line, because I have a huge model and I want to reuse this model verification script. I am able to do some thing like this using "sim" command. But the sim command is just simulating the entire model at once, and I could not observe/change the intermediate outputs/inputs. The "sim" command with a certain stop time is running for certain sample periods, but later if I give the next "sim" command, it is running from the beginning and not starting from where it stopped. But, is there any exact matlab command to step and pause (for one sample period time) the simulation, like that in simulink gui.
回答(2 个)
TAB
2015-4-7
Use "step" command in debug mode
>> sim('model', 'debug', 'on');
%----------------------------------------------------------------%
[TM = 0 ] model.Simulate
(sldebug @0): >> step in
%----------------------------------------------------------------%
[TM = 0 ] model.Start
(sldebug @1): >> step in
%----------------------------------------------------------------%
.... so on
0 个评论
abc NP
2015-4-7
1 个评论
TAB
2015-4-8
As far as I know, it is not possible to debug model from script or function. Debug command are to be entered in debug prompt which is available in command window only.
"ToWorkspace" data is updated at the end of simulation only.
You can change any tunnable parameter during simulation, also while debugging.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Debug Simulations Programmatically 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!