0

Is there a way to end a matlab process that is taking too long to run?

ctrl+alt+delete is all I know right now and that shuts downt he program entirely.

Brian
  • 26,662
  • 52
  • 135
  • 170
  • The program *is* the process AFAIK, unless you have placed hooks in your code that periodically check for a cancel action from the user. – Robert Harvey Aug 30 '10 at 23:58
  • 1
    check this question for additional ideas: http://stackoverflow.com/questions/3272541/matlab-stop-and-continue-execution-from-debugger-possible – Amro Aug 31 '10 at 00:26
  • 2
    Duplicate: [How to abort a running program in MATLAB?](http://stackoverflow.com/questions/1500314/how-to-abort-a-running-program-in-matlab) – gnovice Aug 31 '10 at 01:42

2 Answers2

4

It's Ctrl+C.

Apparently it's inconsistent at times: http://www.mathworks.com/support/solutions/en/data/1-188VX/

gary
  • 4,227
  • 3
  • 31
  • 58
1

Control C is the answer. It will break in. However, there are cases where it still may take a while to do the interrupt. For example, if the process is trying to solve a huge linear system of equations or allocate a huge block of virtual memory, then matlab will not see the interrupt until the solver returns control to matlab itself. So it may take a while before the break happens. If this is just a long running iterative process, then the break will happen quickly.

  • 1
    I also find it handy to make sure I have the Command Window active before I press Ctrl+C, as I usually have the Editor Window selected when I activatie a script. – Geodesic Aug 31 '10 at 03:54
  • Good point. Essentially, matlab needs to know that you are talking to it when you hit the ctrl+c. Otherwise it simply won't see this as an event to act on. –  Aug 31 '10 at 10:42