get(0,'Mon​itorPositi​ons') outputs wrong values

조회 수: 14 (최근 30일)
Z.P.
Z.P. 2018년 10월 26일
편집: adams13 2025년 9월 30일
Hello,
I have a big issue with the outputs from
get(0,'MonitorPositions')
when the screen is changed within one MATLAB session!
For example:
I start my PC and run my Monitors at my standard resolution. Then I type
get(0,'MonitorPositions')
and it is just fine.
But when i plug in a projector for example or change the resolution of my screen and just run the same code
get(0,'MonitorPositions')
then it outputs the same values like before even though the resolution obviously changed!
I have written a function that needs the correct resolution of the attached displays, but now it is just a desaster.
Hope someone can help me.

답변 (1개)

Adam Danz
Adam Danz 2018년 10월 26일
편집: Adam Danz 2018년 10월 26일
As stated in the documentation (<- link),
MATLAB® sets the display information values for this property at startup. The values are static. If your system display settings change, the values do not update. To refresh the values, restart MATLAB.
  댓글 수: 4
Stephen23
Stephen23 2018년 10월 26일
"...also don't set it up to automatically receive a message that the screen configuration has changed."
I very doubt that this is trivial to achieve on a multi-OS application.
adams13
adams13 2025년 9월 30일
편집: adams13 2025년 9월 30일
In R2024b under Windows 11, get(0, 'MonitorPositions') looks to dynamically reflect the change, even without restarting MATLAB. After I connect or disconnect an additional monitor, the next call shows correct number of monitors.

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

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by