step by step simulation in command line for simulink model

7 ビュー (過去 30 日間)
abc NP
abc NP 2015 年 4 月 7 日
コメント済み: Walter Roberson 2015 年 5 月 6 日
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
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

abc NP
abc NP 2015 年 4 月 7 日
Hi @TAB, Thanks,I am almost near to the solution. However in the debug command prompt, every time I type "step over" my output variables like "ToWorkspace" are not updating. I also want to change values of some input block after certain timesteps. Furthermore, I want to give the step-in(or next) commands in the matlab script itself. May be I am too greedy for the exact solution, can someone please help this?
  1 件のコメント
TAB
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 ExchangeChemistry についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by