Start Simulink Model with App Designer and run simultaneously

조회 수: 15 (최근 30일)
Hello,
I have an App which changes Values of Simulink blocks with the set_param command.
My problem is that I have to start the Simulink Model myself because I couldn't find any command with which I could start the simulation via Code AND run the App simultaneously.
With the sim command I was able to start the simulation but my App stopped executing until the Simulink Model stopped, so the sim command is not the right command for me.
I was able to find a workaround with the Callback ability of Simulink Blocks but it is not the perfect solution for me, because with this way I need to start the simulation and the App starts afterwards. The problem is, that my App is the "mother" of all the Functions and the simulation so I want to start the App first...
I hope You can help me to find a solution to my problem.
Thank You very much!
  댓글 수: 4
Fangjun Jiang
Fangjun Jiang 2019년 9월 17일
Okay, then add code in your app to open and simulate the model. Then, just run the app.
Ahmet Sahin
Ahmet Sahin 2019년 9월 17일
Yes that‘s the plan but the problem is that I don‘t know which command I should use. Like I‘ve wrote, the sim command doesn‘t work for me because the program continues only after the Simulation stopped but the simulation time of my Simulink Model is infinite. So using the sim command is not the right choice for me.. Do you have an idea how to call a simulink model without getting stuck at one line?

댓글을 달려면 로그인하십시오.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2019년 9월 17일
f14;
set_param('f14','SimulationCommand','start');
set_param('f14','SimulationCommand','stop')
  댓글 수: 2
Ahmet Sahin
Ahmet Sahin 2019년 9월 18일
편집: Ahmet Sahin 2019년 9월 18일
Thank You very much, this helped me alot!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by