21

Sometimes after calling a function (which takes some 30 odd minutes to finish), you realize that you did something wrong and want to stop the program.

How do you do that in MATLAB?

What I do is shutdown MATLAB completely and restart. I think there would be a way to abort the execution of the function instead.

Anybody know what that is?

gnovice
  • 125,304
  • 15
  • 256
  • 359
Lazer
  • 90,700
  • 113
  • 281
  • 364
  • In case you run into the situation where `CTRL + C` does not do the trick, this thread may be relevant: http://stackoverflow.com/questions/4791144/how-to-stop-a-running-script-in-matlab – Dennis Jaheruddin Jun 09 '13 at 12:15

1 Answers1

30

Hitting Ctrl + C usually does the trick, although sometimes it has been known to run into snags.

gnovice
  • 125,304
  • 15
  • 256
  • 359
  • 5
    I've often found that adding a drawnow() call in a loop helps Matlab catch Ctrl+C. – mtrw Sep 30 '09 at 20:58