Path: news.mathworks.com!not-for-mail
From: "Todd Welti" <twelti@harman.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to stop execution
Date: Wed, 11 Mar 2009 23:52:02 +0000 (UTC)
Organization: Harman Industries International
Lines: 15
Message-ID: <gp9ir2$kcf$1@fred.mathworks.com>
References: <gp98u4$g9h$1@fred.mathworks.com> <XgWtl.34251$l71.6225@newsfe23.iad>
Reply-To: "Todd Welti" <twelti@harman.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1236815522 20879 172.30.248.38 (11 Mar 2009 23:52:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 11 Mar 2009 23:52:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 57524
Xref: news.mathworks.com comp.soft-sys.matlab:524187


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?