Why am I unable to consistently use Ctrl+C to break out of an operation in MATLAB 6.0 (R12) and later versions?

76 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 24 May 2013
The level of response from MATLAB when using Ctrl+C to break out of an operation depends on the operating system. Since UNIX uses asynchronous signals, it is possible to break out of any operation and into the signal handler at any time. However, Windows machines do not operate this way. MATLAB code must poll the operating system to determine whether Ctrl+C has been attempted. Since not all code that is being executed is MATLAB code, there are times when we have no reasonable way to break out (e.g. when running MEX-files, or when doing heavy mathematical computations in the LAPACK libraries).
NOTE: The following are known Ctrl+C behaviors in specific versions of MATLAB for Windows.
In general, when you use Ctrl+C, MATLAB should break execution at the next call to DRAWNOW, PAUSE, GETFRAME, or with a return to the command prompt.
1. In MATLAB 6.0 (R12) it takes a little while to break out of an operation during graphics animation routines. Continue to hold Ctrl+C.
2. MATLAB 6.1 (R12.1) will not break out of a graphics routine at all unless the command window is the active window. Therefore, you will need to click on the command window before trying to use Ctrl+C. If your graphics animation loop brings your figure to the foreground within the loop, then it can be quite difficult to break this routine. Note that when you click on the command window to make it active, you do not need to wait for the command window to become active before pressing Control-C. However, if the figure is made active again in the code, then it will be difficult to execute a Ctrl+C between graphics updates.
NOTE: The ability to use Ctrl+C to exit from a MEX function is not available for any version of MATLAB.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!