The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: try catch /ctrl-c behaviour
Replies: 4   Last Post: Feb 25, 2014 4:17 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: try catch /ctrl-c behaviour
Posted: Apr 5, 2013 10:23 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Nasser M. Abbasi" <> wrote in message
> 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
>>out some processing on a partially analyzed dataset? Currently, ctrl-c
>>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.

Having your program create an onCleanup object that saves the workspace as
its cleanup function before entering the loop is another possibility.

Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.