|
Hello
I am designing a system to check the continuity of a rotary switch respect to its angle. I would like to plot the continuity vs angle in both ClockWise and AntiClockwise direction for about x number of cycles.
Say for example
angle = [0:0.9:10];
continuity_cw = [0 0 0 0 0 0 1 1 1 1 0 0];
continuity_acw = [0 0 0 0 0 1 1 1 1 0 0 0];
I have designed a GUI such that
axes(handles.axes1);
x = NaN(1,length(angle));
handles.plot = plot(x,x);
Now in my timer function, I want to plot the continuity_cw vs angle and continuity_acw vs angle in two different colors. But I am unable to do so.
I have used the following command in my timer function
set(handles.plot,'XData',angle,'YData',continuity_cw); %plot CW data
set(handles.plot,'Color','r');
set(handles.plot,'XData',angle,'YData',continuity_acw); %plot ACW data
set(handles.plot,'Color','b');
But it plots in one color only. Also my data of the continuity_cw also gets overwritten by continuity_acw
My question is how to plot the above in two different color ?
Regards
Vihang
|