in Matlab 2017a on Windows 10, I have compiled my Matlab script. I made sure the box "Do not display the Windows Command Shell (console) for execution" was NOT checked. The uncompiled program runs fine and prints results to the Matlab command window. The compiled program runs and the console window is open while the program runs, but as soon as the program finishes, the console window closes. How do I prevent he console window from closing when program finishes?

 Akzeptierte Antwort

Greg
Greg am 21 Jan. 2018
Bearbeitet: Greg am 21 Jan. 2018

2 Stimmen

The task is finished, so the process ends. Ending the process closes the command prompt.
You can launch a Windows command prompt and call the executable from there.
Or you can add something to the end of your code to prevent completion. One idea is:
if isdeployed % Optional, use if you want the non-deployed version to exit immediately
input('Press enter to finish and close');
end

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 20 Jan. 2018

Bearbeitet:

am 21 Jan. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by