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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!