Azzera filtri
Azzera filtri

How to delete previous points while plotting?

1 visualizzazione (ultimi 30 giorni)
monmatlab
monmatlab il 17 Gen 2017
Modificato: monmatlab il 17 Gen 2017
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:
handles.figureHandle=figure;
guidata(hObject, handles);
t=1/200; %sample rate 5ms
%%button function:
if 40< newSamples
figure(handles.figureHandle)
t = max(t) + (1:size(sample,1)) * 1/200;
for x=1:8
subplot(8,8,x);
hold on
line('XDATA',t,'YDATA',sample(:,x),'MarkerSize', 1,'Color','r');
ylim([0 1024]);
xlim([max(t)-1 max(t)+2]);
hold off
end
drawnow ;
end

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by