plot data into a while lopp without storing the data
4 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a while loop that iterates 2500 times and in each loop I get 3 arrays of 6x1. I dont want to store the data for each iteration, only plot the actual data and keep updating the same plot... is that possible??
Thanks in advance
2 个评论
采纳的回答
Voss
2022-1-20
If you want each new iteration to replace previously plotted results:
i = 0
while i < 2500
% do stuff
hold off
plot(x)
hold on
plot(y)
plot(z)
drawnow()
i = i+1;
end
If you want each new iteration to add to the previously plotted results:
hold on
i = 0
while i < 2500
% do stuff
plot(x)
plot(y)
plot(z)
drawnow()
i = i+1;
end
3 个评论
Voss
2022-1-21
The line:
plot(i,qs(1,1))
plots one point. What happens if you replace that with this:
plot(qs(:,1))
or perhaps this:
plot(i*ones(n,1),qs(:,1))
Try those and see if it's more like what you want.
(And if you attach the necessary mat files, I'll be able to run the code and provide more useful help.)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!