figure Position property returning incorrect values

3 次查看(过去 30 天)
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 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by