Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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: 17,944
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" <nma@12000.org> wrote in message
news:kjm6mi$tn5$1@speranza.aioe.org...
> 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.


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

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.