Hi
I have a GUI app that controls a moving scanner and reads data from an A/D board while the axes are moving.
My "SCAN" button callback loops, say, 1000 times reading the A/D board and processing data while the axes are moving.
I have another "STOP" button on my GUI to stop the axes' motion.
If I am in the SCAN button callback, the STOP button callback will not execute, which means there's no way to do a stop (emergency or otherwise) until the SCAN loop is complete.
Can I construct a STOP callback that can interrupt the SCAN callback?
--Ed
|
|
0
|
|
|
|
Reply
|
Ed
|
6/2/2010 8:32:22 PM |
|
Ed Nieters wrote:
> I have another "STOP" button on my GUI to stop the axes' motion.
> If I am in the SCAN button callback, the STOP button callback will not
> execute, which means there's no way to do a stop (emergency or
> otherwise) until the SCAN loop is complete.
>
> Can I construct a STOP callback that can interrupt the SCAN callback?
Please read the following documentation:
http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/bq61qtj-1.html
|
|
0
|
|
|
|
Reply
|
Walter
|
6/2/2010 8:38:06 PM
|
|
Alternatively, could I read the A/D board in a periodic timer function?
My problem then is how do I pass the read data back so the GUI can see it?
Are timer functions run in separate (interruptible) threads?
--Ed
Walter Roberson <roberson@hushmail.com> wrote in message <hu6fhs$e8j$1@canopus.cc.umanitoba.ca>...
> Ed Nieters wrote:
>
> > I have another "STOP" button on my GUI to stop the axes' motion.
> > If I am in the SCAN button callback, the STOP button callback will not
> > execute, which means there's no way to do a stop (emergency or
> > otherwise) until the SCAN loop is complete.
> >
> > Can I construct a STOP callback that can interrupt the SCAN callback?
>
> Please read the following documentation:
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/bq61qtj-1.html
|
|
0
|
|
|
|
Reply
|
Ed
|
6/2/2010 8:56:05 PM
|
|
Ed Nieters wrote:
> Are timer functions run in separate (interruptible) threads?
timer functions are, as far as I know, _not_ run in separate threads. The
documentation I pointed you to describes the conditions under which a callback
is eligible for interruption, and lists the various points at which pending
interrupts will actually cause context switches. You need to code one of those
calls in to your SCAN callback. If you cannot do so, if the SCAN callback is a
"black box", then you will not be able to accomplish what you had hoped to do.
> Alternatively, could I read the A/D board in a periodic timer function?
Yes.
> My problem then is how do I pass the read data back so the GUI can see it?
See guidata()
|
|
0
|
|
|
|
Reply
|
Walter
|
6/2/2010 9:11:37 PM
|
|
Walter Roberson <roberson@hushmail.com> wrote in message <hu6hgo$hnf$1@canopus.cc.umanitoba.ca>...
> Ed Nieters wrote:
>
> > Are timer functions run in separate (interruptible) threads?
>
> timer functions are, as far as I know, _not_ run in separate threads. The
> documentation I pointed you to describes the conditions under which a callback
> is eligible for interruption, and lists the various points at which pending
> interrupts will actually cause context switches. You need to code one of those
> calls in to your SCAN callback. If you cannot do so, if the SCAN callback is a
> "black box", then you will not be able to accomplish what you had hoped to do.
>
I recently had a discussion with technical support regarding timer functions. I believe timer functions have changed how they operate. I think initially they ran like any other callback and waited paitently for the event queue to be flushed (e.g., drawnow or a return to the Matlab prompt). I am not sure what "thread" they run on, but according to technical support, timers callbacks can now exceute between any 2 lines of code. I am not sure what defines a line of code. I think that mex files may be a single line of code. I think that one line with two commands on it, might be 2 lines of code.
|
|
0
|
|
|
|
Reply
|
Daniel
|
6/2/2010 10:43:04 PM
|
|
|
4 Replies
419 Views
(page loaded in 0.05 seconds)
Similiar Articles: Can I interrupt a running GUI callback? - comp.soft-sys.matlab ...Hi I have a GUI app that controls a moving scanner and reads data from an A/D board while the axes are moving. My "SCAN" button callback loops, ... Stop running program without exiting current GUI - comp.soft-sys ...Can I interrupt a running GUI callback? - comp.soft-sys.matlab ... Stop running program without exiting current GUI - comp.soft-sys ... Can I interrupt a running GUI ... Update Data using callback of Uitable - comp.soft-sys.matlab ...Can I interrupt a running GUI callback? - comp.soft-sys.matlab ... Update Data using callback of Uitable - comp.soft-sys.matlab ... Update Data using callback of Uitable ... reset callback in GUI - comp.soft-sys.matlabHi ... for Graphic User Interface ... ... calling openingfcn to reset GUI - comp ... Can I interrupt a running GUI callback? - comp.soft-sys.matlab ... Passing variables between GUI calback functions - comp.soft-sys ...Can I interrupt a running GUI callback? - comp.soft-sys.matlab ... My problem then is how do I pass the read data back so the GUI can see it? Are timer functions run ... use input from GUI to run another .m file, show output in GUI ...Can I interrupt a running GUI callback? - comp.soft-sys.matlab ... use input from GUI to run another .m file, show output in GUI ... CallBacks in function .m files - comp ... GUI, interuption while loop - comp.soft-sys.matlabGUI, interuption while loop - comp.soft-sys.matlab GUI, interuption while loop - comp.soft-sys.matlab Can I interrupt a running GUI callback? - comp.soft-sys.matlab ... How to make a stopwatch run in matlab gui? - comp.soft-sys.matlab ...GUI, timer, handles - comp.soft-sys.matlab GUI, timer, handles - comp.soft-sys.matlab Can I interrupt a running GUI callback ... sys.matlab GUI, timer, handles - comp.soft ... Open one GUI from another GUI - comp.soft-sys.matlabHi ... for Graphic User Interface ... use input from GUI to run another .m file, show output ... Can I interrupt a running GUI callback? - comp.soft-sys.matlab ... GUI - comp ... How to access changed GUI handle data in OutputFcn? - comp.soft ...Can I interrupt a running GUI callback? - comp.soft-sys.matlab ... Hi I have a GUI app that controls a moving scanner and reads data from an A ... soft-sys.matlab ... for ... Can I interrupt a running GUI callback? - comp.soft-sys.matlab ...Hi I have a GUI app that controls a moving scanner and reads data from an A/D board while the axes are moving. My "SCAN" button callback loops, ... Stop running program without exiting current GUI - Newsreader ...Subject: Stop running program without exiting current GUI. From: yan huang. Date: 14 Dec, 2010 09:20:05 ... > function pushbutton_Run_Callback(hObject, eventdata, handles) ... 7/24/2012 4:09:30 AM
|