how MATLAB determines order of monitors

조회 수: 5 (최근 30일)
André
André 2024년 1월 21일
편집: André 2024년 2월 29일
Does anyone know how MATLAB determines the order of the monitors, when multiple monitors are connected?
I did this:
>> get(0, 'MonitorPositions')
ans =
-1919 -2182 1920 1080
1 1 1536 864
Why isn't the monitor whose position starts with (1,1) the first? My Windows settings clear state that this monitor is the principal one. Even if I go to Windows settings and rearranje the monitors (left-right), nothing changes (only the coordinates change). And if I set the secondary monitor as the principal one, nothing changes either.
Restarting MATLAB does not solve the issue (only the coordinates change).
Restarting Windows does not solve the issue (only the coordinates change).
I need a consistent way to identify each monitor being used by MATLAB.

답변 (1개)

Taylor
Taylor 2024년 1월 23일
Can you share the values you get when restarting MATLAB and Windows? It's hard to tell exactly why the (1, 1) monitor isn't the first index, but it may be as simple as they sort the indexes based on the x-position. I have two monitors and this is my return:
get(0, "MonitorPositions")
ans =
1 1 1920 1080
1921 1 1920 1080
My primary monitor is on the left so this ordering makes sense to me. I'm wondering if your primary monitor is on the right which is why you're seeing negative position values.
  댓글 수: 1
André
André 2024년 2월 28일
편집: André 2024년 2월 29일
Lets call integrated monitor A, and external monitor B.
Lets call primary monitor 1 and secondary monitor 2.
Lets call left monitor L and right monitor R.
Here are the combinations:
1-A-L, 2-B-R:
>> get(0, "MonitorPositions")
ans =
1921 -215 1920 1080
1 1 1536 864
1-A-R, 2-B-L:
>> get(0, "MonitorPositions")
ans =
-1919 -215 1920 1080
1 1 1536 864
Regardless of what happens, montitor A comes always in second row of the array, even when it is the primary monitor. It should come in first row, not second, because IT IS THE INTEGRATED MONITOR, not the external one.
Coordinates are correct, but row positions in the array are wrong.
Lets now swap the main monitor:
2-A-L, 1-B-R:
>> get(0, "MonitorPositions")
ans =
1 1 1920 1080
-1919 217 1536 864
2-A-R, 1-B-L:
>> get(0, "MonitorPositions")
ans =
1 1 1920 1080
1921 217 1536 864
Monitor A remains in second row, even after flipping everything. I want monitor A to be in first row of the array, because it is the primary monitor.
Restarting MATLAB or windows does not solve the issue.
BTW, if I disconect the external monitor and connect a different one, the problem is solved. But when I connect this monitor again, the problem returns.
MATLAB is being extremely stubborn, and keeps putting the primary monitor in second row of the array, but this only happens when a specific secondary monitor is connected.

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

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by