figure Position property returning incorrect values

5 Ansichten (letzte 30 Tage)
André
André am 4 Apr. 2019
Bearbeitet: André am 4 Apr. 2019
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é

Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by