How can I exit Simuink completely?
10 views (last 30 days)
Show older comments
I have a function containing isSimulinkStarted. I want my testcase to test both conditions, but once Simulink has started, it will stay started forever.
0 Comments
Answers (1)
Nithin
on 24 Feb 2025
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 Comment
Walter Roberson
on 24 Feb 2025
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.
See Also
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!