10

Is there any way to get the screen size in pixels for a secondary monitor using Matlab? get(0,'ScreenSize') seems to only recognize the screen on the main monitor.

1 Answer 1

14

Try using get(0,'MonitorPositions') instead. It returns the width and height of primary and secondary monitors, in pixels.

2
  • 4
    Thanks! I tried this out and got this: 1 1 1280 1024 -1919 -175 0 1024 To get the screen size of the secondary monitor I did this: dual=get(0,'MonitorPositions'); scrsz = [(dual(2,3)-dual(2,1)),(dual(2,4)-dual(2,2))];
    – mirri66
    Mar 11, 2011 at 5:59
  • On a Mac (macOS 10.12) I had a problem where get(0,'MonitorPositions'); wouldn't find both displays. Restarting the computer with both displays plugged in solved the issue. Just for posterity.
    – Steve Heim
    Jun 23, 2017 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.