Figures update from respective function from iterative process

5 ビュー (過去 30 日間)
Bert Taekels
Bert Taekels 2017 年 11 月 2 日
コメント済み: Bert Taekels 2017 年 11 月 3 日
i have a code with an iterative process. Each step is done by a different function to allow easy future enhancements. Most of the functions have a plot for visualization (4 separate figures). Now each iteration creates a new figure for each function. So 2 iterations create 8 figures, 3 create 12 etc. I would like that during each iteration the figure is updated (so new info gets added to the previous figure its own function). So i end up with 4 figures where all info is visible for all iterations per function. Is there an easy way to do this? Thanks in advance Bert

回答 (1 件)

KSSV
KSSV 2017 年 11 月 2 日
figure(1)
h(1) = plot(rand(10,1),rand(10,1),'r') ;
figure(2)
h(2) = plot(rand(10,1),rand(10,1),'g') ;
for i = 1:10
set(h(1),'XData',rand(1,10),'YData',rand(1,10)) ;
set(h(2),'XData',rand(1,10),'YData',rand(1,10)) ;
pause(0.1)
end
  2 件のコメント
Bert Taekels
Bert Taekels 2017 年 11 月 2 日
the figures are now created in each function separately. This won't work like it is proposed. But maybe i can call in the globals and create the figures in the main program( that calls the functions), i guess that would be one way around it.
Bert Taekels
Bert Taekels 2017 年 11 月 3 日
Also in the example code new data overwrites old data, i want to keep all previous data and add the new data to it

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

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by