how to pass variables from simulink to workspace,when simulink has been paused from MATLAB Script

6 次查看(过去 30 天)
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 个评论
tulika Roy
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?

请先登录,再进行评论。

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2012-12-14
Use
set_param('Yourmodel','Simulationcommand','start')
and your data will be saved to workspace
  5 个评论
Azzi Abdelmalek
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
TAB 2012-12-14
@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
Arun Badigannavar 2012-12-19
I am controlling my simulink models in a for loop from matlab script,,so wen i pause the from script,,,its reall not giving values back to workspace,,,,,

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by