clear clearglobal maxv=1000; x=1:0.1:maxv; y=sin(x); function slider_update() //retreive the plotfr handle f=gcbo.parent; plotfr=f.user_data slider=findobj('Tag', 'plot_slider') start=round(slider.Value*0.9); r=start:start+100; ax=plotfr.children; //the plotfr axes handle p=ax.children.children;//the curve handle drawlater() p.data=[r',y(r)'] ax.data_bounds(:,1)=[start;start+100] drawnow() endfunction // Create a figure f = figure("Figure_name", 'Uicontrols Slider',... "Position",[100 100 510 510],... "BackgroundColor",[0.9 0.9 0.9],... "Tag", "uicontrols_demo_figure"); // Frame containing a slider plotfr = figure("Figure_name", 'Uicontrols Plot',... "Position",[100 100 510 510],... "BackgroundColor",[0.9 0.9 0.9],... "Tag", "uicontrols_demo_figure2"); r=1:101 plot(r,y(r)) set(f,"user_data",plotfr); //memorize the plotfr handle slider = uicontrol(f, "Position", [20 50 390 15], ... "Style", "slider", ... "Min", 0, ... "Max", 900, ... "Value", 0, ... "SliderStep", [10 100], ... "Tag", "plot_slider", ... "Callback", "slider_update");