フィルターのクリア

What is the best way to create a persistant figure

9 ビュー (過去 30 日間)
Stuart Layton
Stuart Layton 2011 年 6 月 30 日
I would like to create a figure that persists between multiple calls to plot data. For example I would like to create the figure and then make several calls at a later time that will update or change the data displayed in that figure. I've thought about doing this one of two ways.
Having a function that creates the figure and plots the data and then returns handles for all the graphics objects it created. On subsequent calls I could then pass the handles back to that function. The existence of these handles would then cause the function to plot using those handles instead of creating new ones.
or
Using the matlab object oriented interface I could make all the handles members of the object and then have the object handle the plotting.
The second option seems more elegant and makes more sense in my head, but I fear that its going to be too slow.
Is there a better way solve this problem?
  1 件のコメント
Stuart Layton
Stuart Layton 2011 年 6 月 30 日
Sorry I forgot to add that the figure is quite complex. it will contain multiple axes and plot both lines and images

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

採用された回答

Matt Fig
Matt Fig 2011 年 6 月 30 日
figure
L(1) = plot(1:10);
hold on
L(2) = plot((1:10).^2);
Now if you want to erase L(1) later:
delete(L(1))
Also note that you can get the handle to the axes and use that with PLOT.
  2 件のコメント
Stuart Layton
Stuart Layton 2011 年 6 月 30 日
that works great for simple figures, but not if you have multiple axes or graphics objects you are trying to control (I should have mentioned that in my question)
Matt Fig
Matt Fig 2011 年 6 月 30 日
You should store the handle to each AXES object, then when you want to plot to a particular axes, make that one current by: axes(h).
The same goes for all your graphics handles. Store them then access them as needed...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by