Effacer les filtres
Effacer les filtres

Plot updated in msg box instead of axes

1 vue (au cours des 30 derniers jours)
Prashant Funde
Prashant Funde le 18 Jan 2017
Réponse apportée : Jan le 19 Jan 2017
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?

Réponses (1)

Jan
Jan le 19 Jan 2017
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.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by