You cannot set the clock to a variable. There is no callback for this. However, both FOO and BAR are updated: either
FOO by timerFcn
BAR on widget callbacks
You need to make a function:
updatePlot% updates the chart to display the new FOO or BAR values
and both functions that update FOO or BAR call updatePlot as one of their last responsibilities.
I would also recommend against using global variables. There are better ways to do this. I am a fan of GETAPPDATA and SETAPPDATA. Check out this video I made about it.
http://blogs.mathworks.com/videos/2005/105/03/guide-video-part-two/
You can also try nested functions.
Matlabdoug
source share