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

조회 수: 7 (최근 30일)
Mário Sousa
Mário Sousa 2022년 1월 6일
답변: prabhat kumar sharma 2025년 1월 23일
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?

답변 (1개)

prabhat kumar sharma
prabhat kumar sharma 2025년 1월 23일
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!

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by