Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: chancel

Subject: chancel

From: Andrea Schmidt

Date: 3 Aug, 2007 08:20:47

Message: 1 of 2

Hello,

I need something like an emergency stop switch in my gui. I have a button
for this, but I don't know, how I can cancel the running function. I only
can cancel the running functions with CTRL + C. But I don't know how to
programm it.
Has anybody an idea?
Thank you very much.
Andrea


Subject: chancel

From: John

Date: 3 Aug, 2007 22:04:49

Message: 2 of 2

Andrea,
   You can use setappdata to set a cancel flag. When the
program starts, you can set the flag to 0, like this -
setappdata(<your_fig_handle>,'cancelflag',0);
If your function is running something in a loop, check the
value of this cancelflag at the beginning of the loop by
using getappdata.
cf = getappdata(<your_fig_handle>,'cancelflag');
if cf > 0
   return;
end
 And in the callback routine for your 'emergency switch
button', set this flag value to a positive number like this -
setappdata(<your_fig_handle>,'cancelflag',1);

So, if you have pressed the cancel button during the
execution, the flag gets set and this is checked in the loop
and function returns at that point.

Hope this helps.


"Andrea Schmidt" <external.Andrea.Schmidt@de.bosch.com>
wrote in message <f8uoh0$o3n$1@news4.fe.internet.bosch.com>...
> Hello,
>
> I need something like an emergency stop switch in my gui.
I have a button
> for this, but I don't know, how I can cancel the running
function. I only
> can cancel the running functions with CTRL + C. But I
don't know how to
> programm it.
> Has anybody an idea?
> Thank you very much.
> Andrea
>
>

Tags for this Thread

Everyone's Tags:

gui

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gui Ned Gulley 4 Aug, 2007 01:19:06
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics