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!