フィルターのクリア

Plot updated in msg box instead of axes

1 回表示 (過去 30 日間)
Prashant Funde
Prashant Funde 2017 年 1 月 18 日
回答済み: Jan 2017 年 1 月 19 日
Hello everyone,
I used axes to plot a figure on my gui window. When some message box (dialogue box) pop up that time plot is changed into that popup box instead of taking axes/
How can i fix that axes only for plot so that it can't update in popup box?

回答 (1 件)

Jan
Jan 2017 年 1 月 19 日
Define the parent, when you create a graphical object:
FigH = figure;
AxesH = axes('NextPlot', 'add', 'Parent', FigH);
plot(1:10, rand(1:10), 'Color'Parent', AxesH);
DialogBoxH = figure;
DialogAxesH = axes('Parent', DialogBoxH);
text(0.5, 0.5, 'Message', 'Parent', DialogAxesH);
plot(1:10, rand(1:10), 'Parent', AxesH);
This is some additional time during writing, but then it is "thread-safe": Note that e.g. a GUI or TIMER callback can create a new axes object. When you then call e.g. plot, the wrong axes is used. So relying on the current obejct to be the expected one is lazy. Do this is tiny test scripts only, if a messed up output it does not matter. For serios code, the 'Parent' is obligatory.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by