I am interfacing Arduino with MATLAB through serial plot. I have an accelerometer that input three values each time into the serial plot. I am trying to plot the 3 channel data into 3 separate subplot in real time. For some reason, only my last subplot will continuous scroll and the first two will stay at one scroll window.
if(scrollWidth > 0) set(plotgraph1,'XData',time(time > time(count)-scrollWidth),... 'YData',datax(time > time(count)-scrollWidth)); xlim([time(count)-scrollWidth time(count)]); set(plotGraph2,'XData',time(time > time(count)-scrollWidth),... 'YData',datay(time > time(count)-scrollWidth)); xlim([time(count)-scrollWidth time(count)]); set(plotGraph3,'XData',time(time > time(count)-scrollWidth),... 'YData',dataz(time > time(count)-scrollWidth)); xlim([time(count)-scrollWidth time(count)]); end
Best Answer