How do I stop my app from closing after messages are displayed?

9 vues (au cours des 30 derniers jours)
Mário Sousa
Mário Sousa le 6 Jan 2022
I am in the process of developing my first MATLAB app and decided to try the application compiler.
I've now installed my app, leaving just a few disp lines without a semicolon.
When I run it, the Windows command prompt closes immediately after my messages are shown.
What do I have to code to avoid this from happening?

Réponses (1)

prabhat kumar sharma
prabhat kumar sharma le 23 Jan 2025
Hello Mário Sousa,
It sounds like your compiled MATLAB application is closing immediately after running, and you'd like it to remain open until you decide to close it. You can achieve this by wrapping your code in a `while` loop, which will keep the application running until a specific condition you define is met.
Here's a simple example:
while true
% Your application code here
% Condition to break the loop
if someCondition
break;
end
end
This loop will keep the application active until `someCondition` becomes true. You can define `someCondition` based on your application's logic or user input.
I hope this suggestion helps resolve the issue!

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by