"Floating" x-axis in plot (animatedline)

1 次查看(过去 30 天)
Phil U
Phil U 2018-2-16
I want to display a signal that changes over time, see the following minimal working example:
figure
curve = animatedline;
grid on;
stop = false;
startTime = datetime('now');
while ~stop
signal = rand();
t = datetime('now') - startTime;
addpoints(curve,datenum(datetime('now')),signal);
ax.XLim = datenum([datetime('now')-seconds(15) datetime('now')]);
ax.YLim = [0 5];
datetick('x','keeplimits')
drawnow
end
I want to continuously display the last 15 seconds of date. Data older than 15 seconds should not be displayed anymore. However, the diagram currently visualizes the overall amount of data. Where is the mistake in my code / How can I achieve the desired behavior?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Animation 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by