bug in MonitorPosition?

5 vues (au cours des 30 derniers jours)
Scott
Scott le 14 Mar 2011
I have a dual screen setup with the secondary monitor to the left of the primary. get(0,'MonitorPosition') returns
>> get(0,'MonitorPosition') ans = 1 1 1050 1400 -1679 1 0 1050
Why is the width of my secondary monitor zero? Bug?

Réponse acceptée

Aurelien Queffurust
Aurelien Queffurust le 14 Mar 2011
  2 commentaires
Scott
Scott le 14 Mar 2011
Thanks!
Scott
Scott le 14 Mar 2011
Oddly, searching all of Mathworks for 'MonitorPosition' found nothing!

Connectez-vous pour commenter.

Plus de réponses (2)

Arthur
Arthur le 3 Nov 2011
As far as I've seen, MonitorPositions returns the bounding rectangles for each screen in the usual computer graphics orientation (origin at top-left, positive Y = down). I have two displays, one is 1280x800 and the other 1280x1024. The 1280x800 is primary; the other is to its right and aligned at the bottom:
>> get(0, 'MonitorPositions')
ans =
1 1 1280 800
1281 -223 2560 800
Thus, the corners of the primary display in graphics coordinates are (1, 1) and (1280, 800), and the secondary display spans (1281, -223) to (2560, 800). In MATLAB coordinates, what you would see in a Position property, the primary display's corners are at (1, 800) and (1280, 1). The secondary's MATLAB coordinates are (1281, 1024) and (2560, 1).
This is clearly not what the documentation describes. If the results were to match the documentation, I would see [1 1 1280 800; 1281 1 1280 1024] for MonitorPositions.

Kristjan Jonasson
Kristjan Jonasson le 30 Mar 2012
Modifié(e) : Kristjan Jonasson le 11 Juil 2013
I was checking my system. The documentation is (almost) correct as of version 2011b. On Windows the entries in each row of the monitorposition matrix are the coordinates of the upper left and lower right corners of each monitor, in a coordinate system where the upper-left pixel of monitor 1 is (1,1), x goes to the right and y goes down (in v. 2011a and before it was incorrectly stated that entries 3 and 4 were monitor width and height). The documentation says that on Linux entries 3 and 4 give width and height (I didn’t check this). However I find that monitor 1 is in the top row (not the bottom row as the documentation says), but that is not very serious.
Thus both of the examples above are consistent with this new documentation.
Another peculiarity is that figure positions are measured with reference to the bottom left corner of monitor 1 (at least on my system). I would guess that one may identify monitor 1 as the monitor which has (xmin,ymin) = (1,1) regardless of which row in monitor position it appears in.
Update on July 10 2013: Links to the relevant Matlab documentation are: root properties and positioning figures. Note that it is the primary (or main) monitor (the one with the Start menu) that has (1,1) at it's top left (and it may be number 2). The Matlab documentation incorrectly states that "The monitor labeled as device 1 in the Windows control panel remains the reference monitor that defines the position of the origin however you reposition the monitors".

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by