I have tried to make a simple coding, but I have a problem when I set slider1, why do axes2 react too?
function slider1_Callback(hObject, eventdata, handles)
global s1;
slider=get(hObject,'value');
set(handles.edit1,'string',num2str(slider));
guidata(hObject,handles);
pos1=slider/180;
writePosition(s1,pos1);
y1= [0 1 0 0 ];
x1= [0 0 1 20 ];
y2= [0 1 0 0 ];
x2= [0 0 1.5 20 ];
y3= [0 1 0 0 ];
x3= [0 0 2 20 ];
i=0;
i=i+1;
v(i)=readPosition(s1);
if (v(i)<0.5)
stairs(x1,y1,'LineWidth',2);
elseif (v(i)==0.5 || v(i)>0.5 && v(i)~=1)
stairs(x2,y2,'LineWidth',2);
elseif (v(i)==1)
stairs(x3,y3,'LineWidth',2);
end
axes(handles.axes1);
set(gca,'XTick', 0:1:20);
xlabel('lebar pulsa (ms)');
function slider2_Callback(hObject, eventdata, handles)
global s2;
slider=get(hObject,'value');
set(handles.edit2,'string',num2str(slider));
guidata(hObject,handles);
pos1=slider/180;
writePosition(s2,pos1);
y1= [0 1 0 0 ];
x1= [0 0 1 20 ];
y2= [0 1 0 0 ];
x2= [0 0 1.5 20 ];
y3= [0 1 0 0 ];
x3= [0 0 2 20 ];
i=0;
i=i+1;
v(i)=readPosition(s2);
if (v(i)<0.5)
stairs(x1,y1,'LineWidth',2);
elseif (v(i)==0.5 || v(i)>0.5 && v(i)~=1)
stairs(x2,y2,'LineWidth',2);
elseif (v(i)==1)
stairs(x3,y3,'LineWidth',2);
end
axes(handles.axes2);
set(gca,'XTick', 0:1:20);
drawnow;