フィルターのクリア

How to plot simulation results in a GUI while the simulation is running?

11 ビュー (過去 30 日間)
Dark_Knight
Dark_Knight 2023 年 8 月 2 日
コメント済み: Dark_Knight 2023 年 9 月 13 日
I need to plot the simulation results in a GUI while simulation is running, so that the plot will be updated whenever the simulation results are updated.I have tried using To Workspace block and To File block, both outputs the results to workspace or file only when the simulation is paused or stopped. I cannot pause the simulation neither wait for the simulation to stop just for updating the GUI. Is there any way by which I could plot the simulation result in live on the GUI?
When I am trying to access engineTorque value when the simulation is running, it says variable not found. When I pause the simulation I am able to accesss the engineTorque.But my requirement is to access engineTorque value(time,data) when the simulation is running.
NOTE:
1. The GUI can be opened in another MATLAB instance also.
2. Simulation is started with Sim command.
3. It will be helpful if solutions are specific to R2021a.

採用された回答

Fangjun Jiang
Fangjun Jiang 2023 年 8 月 31 日
  4 件のコメント
Fangjun Jiang
Fangjun Jiang 2023 年 9 月 13 日
This approach gives you quick and easy access of the run-time data. I don't think there is any more APIs. You might consider the run-time objects in the first link, or search for SDI (Simulink Data Inspector).
Dark_Knight
Dark_Knight 2023 年 9 月 13 日
Thank you for your information.

サインインしてコメントする。

その他の回答 (1 件)

VBBV
VBBV 2023 年 8 月 2 日
Use drawnow command for updating the simulation results
Read more about the command here
https://in.mathworks.com/help/matlab/ref/drawnow.html
  1 件のコメント
Dark_Knight
Dark_Knight 2023 年 8 月 2 日
Sorry for the lack of information in my question. I have updated it, please refer the question once more.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by