Jacc
Automotive
- Oct 22, 2002
- 142
Hey hey hey!
Whenever I want to analyze a mathematical function with multiple parameters I make a quick GUI in Matlab. I assign sliders to each of the parameters I want to change and their callback functions replot the function with the new value. Here is a very simple example:
Main Program
-------------------------------------------------------
a=4;
fighandle=figure(1)
slidehandle = uicontrol(fighandle,'Style','Slider')
set (slidehandle,'Value',4,'Min',1,'Max',20,'Callback','UIcall_2(slidehandle)')
set (slidehandle,'SliderStep',[0.1 1])
x=1:100;
y=x.^2+a.*x;
plot(x,y,'x')
----------------------------------------------------------
Callback Function
----------------------------------------------------------
function UIcall(slidehandle)
a=get(slidehandle,'Value')
x=1:100;
y=x.^2+a.*x;
plot(x,y,'x')
----------------------------------------------------------
Nice isn't it?
Well, this is my problem:
When I klick and hold on one of the slider arrows to make it sweep through it's range the whole figure flickers!
Sure you can see the curve changing shape and all that but my current project includes a bunch of lines and A LOT of sweeping sliders through their ranges, full screen of course, and this flickering is a big problem!
I'm not epileptic but if I was I would have seized for good by now!
Just a few minutes ago after I had been messing with it the damned thing started to move smooth as silk without a trace of flickering! Just the lines changing supersmooth on the screen but ofcourse next time I hit run it was back to hysteric flickering...
What's causing this and how can I make it go away?
Is it a figure property issue, NextPlot or something?
Or should I plot using line instead?
Or perhaps plot using set(line_handle,'XData',x,'YData',y)?
Thank you for reading this far and good night!
Whenever I want to analyze a mathematical function with multiple parameters I make a quick GUI in Matlab. I assign sliders to each of the parameters I want to change and their callback functions replot the function with the new value. Here is a very simple example:
Main Program
-------------------------------------------------------
a=4;
fighandle=figure(1)
slidehandle = uicontrol(fighandle,'Style','Slider')
set (slidehandle,'Value',4,'Min',1,'Max',20,'Callback','UIcall_2(slidehandle)')
set (slidehandle,'SliderStep',[0.1 1])
x=1:100;
y=x.^2+a.*x;
plot(x,y,'x')
----------------------------------------------------------
Callback Function
----------------------------------------------------------
function UIcall(slidehandle)
a=get(slidehandle,'Value')
x=1:100;
y=x.^2+a.*x;
plot(x,y,'x')
----------------------------------------------------------
Nice isn't it?
Well, this is my problem:
When I klick and hold on one of the slider arrows to make it sweep through it's range the whole figure flickers!
Sure you can see the curve changing shape and all that but my current project includes a bunch of lines and A LOT of sweeping sliders through their ranges, full screen of course, and this flickering is a big problem!
I'm not epileptic but if I was I would have seized for good by now!
Just a few minutes ago after I had been messing with it the damned thing started to move smooth as silk without a trace of flickering! Just the lines changing supersmooth on the screen but ofcourse next time I hit run it was back to hysteric flickering...
What's causing this and how can I make it go away?
Is it a figure property issue, NextPlot or something?
Or should I plot using line instead?
Or perhaps plot using set(line_handle,'XData',x,'YData',y)?
Thank you for reading this far and good night!