Borrar filtros
Borrar filtros

Plot updated in msg box instead of axes

1 visualización (últimos 30 días)
Prashant Funde
Prashant Funde el 18 de En. de 2017
Respondida: Jan el 19 de En. de 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?

Respuestas (1)

Jan
Jan el 19 de En. de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by