MATLAB Answers


Force update scope window when running rapid accelerator mode from command line

Kaixiang Wang 님이 질문을 제출함. 4 Oct 2018
최근 활동 Qiaoli Ji 님이 답변함. 19 Dec 2018
As stated in Design Your Model for Effective Acceleration, Simulink does not allow the update of scope unless the rapid accelerator model is run from Simulink menu, for whatever reason. However, I am using a GUI to call the Simulink model and I wish to see real-time output using the scope, but the scopes won't update.
I wonder if there is a way to change this Simulink behaviour (this restriction really seems artificial to me). Alternatively, I wonder if there is a way to pretend (using command line code) that I am running the model from Simulink menu.

  댓글 수: 0

로그인 to comment.

답변 수: 2

Answer by TAB
on 5 Oct 2018
Edited by TAB
on 5 Oct 2018
 Accepted Answer

Scope will not update with sim command, but it works with SimulationCommand (please dont ask why :P)
set_param('MyModel', 'SimulationCommand', 'start')
SimulationCommand can take one of following value:
'start' | 'stop' | 'pause' | 'continue' | 'step' | 'update' | 'WriteDataLogs' | 'SimParamDialog' | 'connect' | 'disconnect' | 'WriteExtModeParamVect' | 'AccelBuild'

  댓글 수: 3

Really appreciate your answer!
The bad news for me is that set_param does not wait for the simulation to finish, so my subsequent data analysis code (dependent on simulation export data) is screwed :( . But thanks anyway!
You can use get_param('mymodel', 'SimulationStatus') combined with while loop to wait for simulation to finish.
Thanks for your prompt reply. I thought about this but I doubt this is an efficient solution (in the sense that simulation runs slower). I did a few tests and I think this would increase the simulation time by roughly two or three times.
In the end it might be just a design decision to make. The other option is for me to kindly ask the GUI user to hit the Run Simulation button...

로그인 to comment.

Answer by Qiaoli Ji on 19 Dec 2018

Hi, Kaixiang Wang , I have met a question about matlab compiler installation. So could you help me? Thanks

  댓글 수: 0

로그인 to comment.

Translated by