필터 지우기
필터 지우기

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 CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by