bug in MonitorPosition?

조회 수: 3 (최근 30일)
Scott
Scott 2011년 3월 14일
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?

채택된 답변

Aurelien Queffurust
Aurelien Queffurust 2011년 3월 14일
  댓글 수: 2
Scott
Scott 2011년 3월 14일
Thanks!
Scott
Scott 2011년 3월 14일
Oddly, searching all of Mathworks for 'MonitorPosition' found nothing!

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Arthur
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.

Kristjan Jonasson
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".

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by