How to update a plot/graph?

40 ビュー (過去 30 日間)
lucca k
lucca k 2015 年 11 月 9 日
コメント済み: Walter Roberson 2021 年 6 月 27 日
Hello everybody,
I got a plot like this one:
h = subplot(1,2,1);
plot(0, 0);
axis([-30 40 -20 100 ]);
grid on
Now I am getting a new array of x,y - points every second. How can I update the subplot h with these arrays? It is an n by 2 single array.
Thank you in advance!
Lucca

採用された回答

Image Analyst
Image Analyst 2015 年 11 月 9 日
In your loop where you get new x,y arrays, make sure you have this line after the plot:
plot(.................
drawnow;
drawnow will force the plot to update immediately. Otherwise it probably won't get around to it until the loop is entirely finished so that all you will see is the very last set of data plotted.
  2 件のコメント
Sepehr Ariaei
Sepehr Ariaei 2021 年 6 月 27 日
Does drawnow works on semilogy too?
Walter Roberson
Walter Roberson 2021 年 6 月 27 日
Yes, drawnow() works on all graphics updates.

サインインしてコメントする。

その他の回答 (1 件)

Thorsten
Thorsten 2015 年 11 月 9 日
編集済み: Thorsten 2015 年 11 月 9 日
subplot(1,2,1);
plot(x, y);
drawnow

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by