Hi! I am creating a gui (using GUIDE) that will display an animation that changes in response to the user’s mouse-click input. In order to update the animation at regular intervals, I have created a timer function that plots 1 updated frame of the animation each time it is called. There is only 1 axes on the gui, and its name is ArmAxes.
The problem I’m having is that the only way, so far, that I’ve been able to successfully animate within the timer function is to use the handles structure, as follows:
function animation_timer_fcn(hObject, events,figure_handle)
% update x & y values …
% plot 1 frame of animation
Although the animation displays correctly using this code, unfortunately the use of the handles structure in this timer function interferes with my (necessary) use of the handles structure elsewhere in my gui m-file, and it is causing many different bugs and data problems.
I’m trying to determine whether there is an alternative way to animate within the timer function, that doesn’t use the handles structure. Here are the options I’ve investigated:
a) line_handle = handles.ArmAxes;
b) line_handle = plot(x,y,'r-','LineWidth',2);
-- Both of these options eliminate all of the data problems I had been having when animating using the handles structure, BUT neither option produces any animation.
I have read in various places that using the plot( ) command isn’t efficient, and that using set(axes_handle,’erasemode’,’xor’) is much quicker and more efficient. However, so far, this code hasn’t worked to actually produce animation.
Any suggestions about how I can animate within my timer function, without using the handles structure (and, maybe, also avoiding the plot( ) command?)? Thanks!!