how to add new data to graph plotted by addpoints

1 view (last 30 days)
Hi,
I am using addpoints to plots a graph that changes over time. I want to be able to plot the change mean of the graph, meaning in each iteration to plot a line of the current mean (without deleting the the graph values) how can this be done?
this is my code:
t=1:10;
y=@(t) t;
f=figure('Name','live data');
ax=axes('Parent',f)
h = animatedline('Marker','o','Parent',ax);
figure;
for i=1:10
addpoints(h,i,y(i));
pause(1);
end

Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects 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!