bug in MonitorPosition?

16 views (last 30 days)
Scott
Scott on 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?

Accepted Answer

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

Sign in to comment.

More Answers (2)

Arthur
Arthur on 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 on 30 Mar 2012
Edited: Kristjan Jonasson on 11 Jul 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".

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!