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!