How can I exit Simuink completely?

29 ビュー (過去 30 日間)
Jianfei
Jianfei 2025 年 2 月 20 日 16:47
コメント済み: Walter Roberson 2025 年 2 月 24 日 17:17
I have a function containing isSimulinkStarted. I want my testcase to test both conditions, but once Simulink has started, it will stay started forever.

回答 (1 件)

Nithin
Nithin 2025 年 2 月 24 日 9:12
The "isSimulinkStarted" function determines if the Simulink engine is active, rather than checking if a specific model is open. Once the Simulink environment is initialized, such as by opening a model, it remains active until it is explicitly shut down or exiting MATLAB. Therefore, even after opening and then closing a Simulink model, the "isSimulinkStarted" function will still return "true". For more details on the behavior of the "isSimulinkStarted" function, please refer to the documentation: https://www.mathworks.com/help/simulink/slref/issimulinkstarted.html
To check if a specific Simulink model is open, the "bdIsLoaded" function with the name of the model (as input) can be used.
modelName = 'your_model_name'; % Replace with your model's name
isModelOpen = bdIsLoaded(modelName);
For further information about the "bdIsLoaded" function, please refer to the following documentation: https://www.mathworks.com/help/simulink/slref/bdisloaded.html
To determine if any Simulink model is open, replace "modelName" with "gcs". However, it is important to be aware that this will produce an error instead of returning "false" if no Simulink model is currently open.
I hope this is helpful in resolving the issue.
  1 件のコメント
Walter Roberson
Walter Roberson 2025 年 2 月 24 日 17:17
The question is how to shut down the Simulink engine (without closing MATLAB.)
At the moment I do not see any way of shutting down the Simulink engine.

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

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

タグ

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by