How to delete previous points while plotting?

조회 수: 4(최근 30일)
monmatlab 2017년 1월 17일
편집: monmatlab 2017년 1월 17일
I am plotting live data, for the plotting, I am using the line function, which improved the plotting performance a lot compared when using the plot function. Still, the plot gets slower with time. I realized that the sample points that I am creating are plotted, but even when they are not visible later the still remain in the plot. Could this cause any performance degradation?
I just want to see the sample points of the current three seconds, if use clf or cla function, just see very small part of the signal, which is not helpful for me. Do you have any suggestions?
%%opening function:
guidata(hObject, handles);
t=1/200; %sample rate 5ms
%%button function:
if 40< newSamples
t = max(t) + (1:size(sample,1)) * 1/200;
for x=1:8
hold on
line('XDATA',t,'YDATA',sample(:,x),'MarkerSize', 1,'Color','r');
ylim([0 1024]);
xlim([max(t)-1 max(t)+2]);
hold off
drawnow ;



Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by