how to pass variables from simulink to workspace,when simulink has been paused from MATLAB Script
古いコメントを表示
I am running two simulink model from matlab script(with "sim" command),,now i want to pause the running simulink model in the middle and send the data from "to workspace block" to my matlab workspace at the time wen i paused it,,,,,actually my requirmnet is meeting if i directly run my simulink model from simulnk start pause button,,,but its not working through script
4 件のコメント
Arun Badigannavar
2012 年 12 月 14 日
Arun Badigannavar
2012 年 12 月 14 日
tulika Roy
2012 年 12 月 31 日
I am running the simulink model with a script file I am taking a for loop, after 1 cycle value model runs but in next cycle value it deleted the old value. figure I can use using 'hold on' but how to store and retain old array?
Arun Badigannavar
2013 年 1 月 3 日
回答 (2 件)
Azzi Abdelmalek
2012 年 12 月 14 日
Use
set_param('Yourmodel','Simulationcommand','start')
and your data will be saved to workspace
5 件のコメント
Azzi Abdelmalek
2012 年 12 月 14 日
Maybe you should close a loop then start another loop, I did'nt try it (I have'nt Matlab where I am).
Arun Badigannavar
2012 年 12 月 17 日
Azzi Abdelmalek
2012 年 12 月 17 日
What is 'lenthier' ?
Arun Badigannavar
2012 年 12 月 17 日
Azzi Abdelmalek
2012 年 12 月 17 日
Arun, I tested your problem in a loop, and it worked, the initial value of the unit delay don't change when you pause simulation. I don't know why it don't work for you.
TAB
2012 年 12 月 14 日
0 投票
@Arun, I hope that you don't have any strange varsion of matlab (like Matlab R. Strange).
sim() command will not return till simulation is completed, so off-course your script will never go ahead to execute other commands like pause.
And, see below snap. When I run and pause the model from script using SimulationCommand, then To Workspace block output is saved in workspace. It should work for you also.

18 件のコメント
Arun Badigannavar
2012 年 12 月 14 日
Azzi Abdelmalek
2012 年 12 月 14 日
編集済み: Azzi Abdelmalek
2012 年 12 月 14 日
Arun, can you post your code
Arun Badigannavar
2012 年 12 月 14 日
Arun Badigannavar
2012 年 12 月 14 日
Arun Badigannavar
2012 年 12 月 14 日
Arun Badigannavar
2012 年 12 月 14 日
TAB
2012 年 12 月 14 日
In your code, you are starting the simulation and then setting the stop time. I don't think this is proper way of simulating model.
Ok...One more try....
Can you explain what you are trying to do i simple words, so anyone here can suggest something.
Arun Badigannavar
2012 年 12 月 14 日
Arun Badigannavar
2012 年 12 月 14 日
Azzi Abdelmalek
2012 年 12 月 17 日
If you want to set stop time, do it before start sim or after pause sim. It does'nt make sens to do it after start sim. Other thing, are you sur you are runing your model from m file, if yes, why are you then, using assignin command?
Arun Badigannavar
2012 年 12 月 18 日
編集済み: Walter Roberson
2012 年 12 月 18 日
Arun Badigannavar
2012 年 12 月 18 日
Walter Roberson
2012 年 12 月 18 日
Wouldn't you want to stop at time i+1 rather than i ?
Azzi Abdelmalek
2012 年 12 月 18 日
編集済み: Azzi Abdelmalek
2012 年 12 月 18 日
Arun, If speed_F is the output of another simulink model, that means that this variable is already in workspace, if not, then just use to workspace block
Arun Badigannavar
2012 年 12 月 18 日
Azzi Abdelmalek
2012 年 12 月 18 日
I do'nt understand. Even you pause your simulation, your data will be in workspace.
Arun Badigannavar
2012 年 12 月 19 日
Arun Badigannavar
2012 年 12 月 19 日
カテゴリ
ヘルプ センター および File Exchange で Event Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!