In MATLAB, how do I obtain information about my screen resolution and screen size?
이전 댓글 표시
Using MATLAB, I want to obtain information about my screen resolution and screen size.
채택된 답변
추가 답변 (2개)
Dominik Mattioli
2018년 12월 18일
Res = get(0,'ScreenPixelsPerInch')
This functionality might have been added since MathWorks originally posted their own answer above.
broken_arrow
2021년 10월 10일
편집: MathWorks Support Team
2025년 11월 11일
Concerning size measures in plotting, the fixed "virtual" DPI value on Windows or Linux systems returned by
get(0,'ScreenPixelsPerInch')
means that setting e. g.
figure('Units','pixels','Position',[0 0 1920 1080])
equals a figure size of 1920x1080 screen pixels if the "true" monitor DPI is less than or equal to that "virtual" value (meaning that on a 1920x1080 monitor, the figure will cover the entire screen). For monitors with a true DPI greater than the virtual one, the number of screen pixels per "unit pixel" increases accordingly (props to Walter): https://www.mathworks.com/help/matlab/develop-apps-programmatically.html (thus on a 4K monitor of same size, the aforementioned figure would still cover the whole screen).
The true monitor DPI can be easily calculated manually (Pythagorean theorem) or with an online tool (google "calculate monitor dpi")
댓글 수: 1
Walter Roberson
2021년 10월 10일
96 is used for Windows. For MacOS it is 72.
카테고리
도움말 센터 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!