///withoutPrompt function plot3d_uicontrol() global('a_slider','a_text','b_slider','b_text','a','b','activate','n_fact'); if activate == %t then a=get(a_slider,'Value')/n_fact; b=get(b_slider,'Value')/n_fact; set(a_text,'String','a='+string(a)) set(b_text,'String','b='+string(b)) t=linspace(0,2,200); xbasc();t=linspace(-b*%pi,b*%pi,20);plot3d(t,t,a*sin(t)'*cos(t)); end endfunction function myuidialog() global('a_slider','a_text','b_slider','b_text','a','b','activate','n_fact'); n_fact=100; /// \sleftarrow{\normalfont scaling because sliders work with integers } activate=%f ; /// \sleftarrow{\normalfont delay callback execution} f = figure("Position",[50 50 200 60],"Unit", "pixel"); a_text = uicontrol(f,"Position",[140 10 55 15],"Style","text",... "String" , "a=5") a_slider = uicontrol(f, "Position" , [10 10 120 15],.. "Style" , "slider",... "Min" , 1*n_fact,... "Max" , 10*n_fact,... "Value" , 5*n_fact,... "SliderStep", [1 1],... "callback" , "plot3d_uicontrol()") b_text = uicontrol(f, "Position",[140 35 55 15],"Style","text",... "String" , "b=2") b_slider = uicontrol(f, "Position" , [10 35 120 15],... "Style" , "slider",... "Min" , 1*n_fact,... "Max" , 3*n_fact,... "Value" , 2*n_fact,... "SliderStep", [1 1],... "callback" , "plot3d_uicontrol()") activate=%t; /// \sleftarrow{\normalfont now we accept callback calls} endfunction ///\withPrompt{}