why does windows command shell close?

11 views (last 30 days)
William Rose
William Rose on 20 Jan 2018
Edited: Greg on 21 Jan 2018
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?

Accepted Answer

Greg
Greg on 21 Jan 2018
Edited: Greg on 21 Jan 2018
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

More Answers (0)

Categories

Find more on MATLAB Compiler 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!