Path: news.mathworks.com!not-for-mail
From: "David Doria" <daviddoria@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Send an interrupt from a GUI
Date: Fri, 11 Jul 2008 19:23:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 38
Message-ID: <g58bum$9d5$1@fred.mathworks.com>
References: <g581oe$ic8$1@fred.mathworks.com> <g58auq$sfr$1@fred.mathworks.com>
Reply-To: "David Doria" <daviddoria@gmail.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 1215804182 9637 172.30.248.38 (11 Jul 2008 19:23:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 11 Jul 2008 19:23:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1105197
Xref: news.mathworks.com comp.soft-sys.matlab:478914



Well the problem is more that the loop that you call
"checkForAbort" from is in a separate m file and therefore
wouldn't have access to the button control.  Do you see the
difference?

Thanks,

Dave

> function testAbort
> 
> figh = figure;
> btn = uicontrol('style', 'pushb', 'string', 'Abort', ...
>                 'callback', @doAbort);
> isAborted = false;
> 
> % simulate a long-running computation with PAUSE
****
longFunction(); %unable to check button status from inside
this function!
***
> 
> %% =====
>     function doAbort(h,e)
>         isAborted = true;
>     end
> 
>     function checkForAbort()
>         if isAborted, 
>             error('Aborted');
>         end
>     end
> end
> -------------------------
> 
> Gautam
>