bug in MonitorPosition?
6 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
更多回答(2 个)
Arthur
2011-11-3
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.
0 个评论
Kristjan Jonasson
2012-3-30
编辑:Kristjan Jonasson
2013-7-11
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".
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!