필터 지우기
필터 지우기

figure Position property returning incorrect values

조회 수: 3 (최근 30일)
André
André 2019년 4월 4일
편집: André 2019년 4월 4일
I'm trying the create a GUI, so I stared by drawing a figure. However, I am having problems with the position of the components I place inside the figure (panels, etc).
Here is the code to draw a figure:
mainWindow_oDims = [1280,720];
peakSettings_Position = [50, 50, mainWindow_oDims];
FIG = figure('Name', 'Curve inspector', 'NumberTitle', 'off', 'OuterPosition', peakSettings_Position, 'Resize', 'off', 'MenuBar', 'none');
%pause(0.01); % correct the drawing process----------------------------------------------------------------------------
mainWindow_iDims = FIG.Position(3:4)
Results with the pause instruction disabled:
mainWindow_iDims =
1272 686
Results with pause instruction enabled:
mainWindow_iDims =
1264 681
Can you see the difference? There are 7 pixels changing in the figure dimensions. What is happening here? Why does a simple pause instruction changes the Position property value? The figure seems to be correct. The OuterPosition property is also correct. Only the Position property is wrong.
Do I really need to call pause everytime? (actually calling drawnaw also corrects the drawing)? This is extremely undesirable and It makes me lose confidence wheter MATLAB is giving me the correct values or not.
I think everything is Ok with my monitor settings...
Best regards,
André

답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by