MATLAB Answers

Why does my compiled standalone application sometimes stall until I press a key?

3 views (last 30 days)
I have created a standalone executable with MATLAB Compiler on Windows. I run my application using the Windows Command Prompt. Some times my application stalls for no apparent reason. Pressing any key on the keyboard, or right clicking in the Command Prompt window seems to un-stall the application.
The stall occurs at places in the code which do not make sense. For example, between two 'fprintf' statements.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Jun 2021
Edited: MathWorks Support Team on 22 Jun 2021
This behavior may be due to a feature of the Windows Command Prompt called Quick Edit Mode.
What is Quick Edit Mode?
This is an optional feature of Command Prompt which pauses the execution of the current program when you select text in the command prompt window. This was designed to make it easier to select text.
How can I tell if my application is stalled due to Quick Edit Mode?
The most clear indicator of when Quick Edit Mode has been engaged is that the title bar of the Command Prompt window changes.
For example, under normal operation the title bar of the Command Prompt window may say: "Command Prompt". When quick edit mode is engaged, the title changes to "Select Command Prompt". If you notice that your application has stalled and the title bar of the Command Prompt window has changed in this manner, your application is most likely stalled due to quick edit mode.
Simply press a key on the keyboard with the Command Prompt window focused to un-stall the application.
How can I prevent my application from stalling due to Quick Edit Mode?
Quick Edit mode can be easily disabled for a single Command Prompt window or for all future command Prompt WIndows. Refer to the following link for more information:

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by