Date: Apr 5, 2013 5:49 AM
Author: Nasser Abbasi
Subject: Re: try catch /ctrl-c behaviour

On 4/5/2013 4:27 AM, Peeyush wrote:

> Continuing in the same vein, what if I want to stop the execution
>of a long loop before it's termination condition? and I still want to carry
>out some processing on a partially analyzed dataset? Currently, ctrl-c breaks
>the loop and I lose the intermediate results....
> I'm running Matlab 12 on a Mac.

You have to add your own logic. For example, Make a button and
in the callback set a flag that the main loop checks on at the
end of each iteration. When the main loop detects this flag is set to
terminate, then it can cleanly terminate and do any other
intermediate work.