Azzera filtri
Azzera filtri

Plot updated in msg box instead of axes

1 visualizzazione (ultimi 30 giorni)
Prashant Funde
Prashant Funde il 18 Gen 2017
Risposto: Jan il 19 Gen 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?

Risposte (1)

Jan
Jan il 19 Gen 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.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by