Why does Control+C not break out of an infinite loop on UNIX?

I am trying to run the following code and then break out of it with CTRL-C or CTRL-Break
n=0;
while n < 1
n
end
I have sent the process a kill -2 signal and that did work.

 Accepted Answer

As a workaround, please look up the process ID of MATLAB, and send it an interrupt using the following command:
kill -2 $pid
This is identical to ^C.

More Answers (0)

Categories

Find more on Loops and Conditional Statements 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!