Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to stop execution
Date: Thu, 12 Mar 2009 07:54:04 +0000 (UTC)
Organization: Erasmus MC
Lines: 23
Message-ID: <gpaf2s$hc1$1@fred.mathworks.com>
References: <gp98u4$g9h$1@fred.mathworks.com> <XgWtl.34251$l71.6225@newsfe23.iad> <gp9ir2$kcf$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1236844444 17793 172.30.248.35 (12 Mar 2009 07:54:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 12 Mar 2009 07:54:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: news.mathworks.com comp.soft-sys.matlab:524246


"Todd Welti" <twelti@harman.com> wrote in message <gp9ir2$kcf$1@fred.mathworks.com>...
> Walter Roberson <roberson@hushmail.com> wrote in message <XgWtl.34251$l71.6225@newsfe23.iad>...
> > Todd Welti wrote:
> > > This might seem like a dumb question, but how do you stop code execution?  I dont mean
> > > 'return', or 'dbstop', or 'error'.  I just want to stop the code immediately, with no
> > > fanfare and just return to the command line.
> > 
> > There isn't a way: all of those routines have to be unwound and their workspaces
> > cleaned up, which might invoke exit handlers, and so on.
> > 
> > The closest I can think of is to have your main routine have a try/catch
> > and then when you wish to abort, error() the particular string that the
> > catch is keyed for, and when you detect it, bail out cleanly from your
> > main routine.
> 
> Yes, that should work.  is it just me or is it strange that there is not such a command - like ctrl c, but useable in an mfile?

help keyboard

(or modify finish.m and use quit cancel)

hth
Jos