How can I exit Simuink completely?

10 visualizaciones (últimos 30 días)
Jianfei
Jianfei el 20 de Feb. de 2025
Comentada: Walter Roberson el 24 de Feb. de 2025
I have a function containing isSimulinkStarted. I want my testcase to test both conditions, but once Simulink has started, it will stay started forever.

Respuestas (1)

Nithin
Nithin el 24 de Feb. de 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 comentario
Walter Roberson
Walter Roberson el 24 de Feb. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by