Matlab Screen Size incorrect

49 ビュー (過去 30 日間)
Trevor Harris
Trevor Harris 2015 年 1 月 23 日
回答済み: Petorr 2017 年 12 月 13 日
Seems as if with matlab 2014b the screen size query is off. Have a look at the attached screenshot. Obviously they disagree. Has anyone seen this before?
Trevor
  1 件のコメント
Walter Roberson
Walter Roberson 2016 年 4 月 12 日
Do you have multiple displays?

サインインしてコメントする。

回答 (5 件)

Michelle Hirsch
Michelle Hirsch 2015 年 1 月 26 日
Did you by chance change the screen resolution after starting MATLAB. The ScreenSize property is fixed when MATLAB starts up. If that's not it, I don't have any other ideas.

Guillaume
Guillaume 2015 年 1 月 23 日
Certainly don't know why the discrepancy.
If you do need the screen size in matlab, you could always go through .Net (Windows only), or java.
With .Net:
NET.addAssembly('System.Windows.Forms');
rect = System.Windows.Forms.Screen.PrimaryScreen.Bounds
screensize = [rect.Width rect.Height]
With java:
ge = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment;
gd = ge.getDefaultScreenDevice;
screensize = [gd.getDisplayMode.getWidth gd.getDisplayMode.getHeight]
  2 件のコメント
Yuval Harpaz
Yuval Harpaz 2016 年 4 月 12 日
I got different answer for the two methods! using Java screensize = [3840 2160] (same as windows default on my laptop), and using .NET or get(0, 'screensize') it is [1536 864], and in inches it is 9 by 16 for a 15" screen.
Guillaume
Guillaume 2016 年 4 月 12 日
編集済み: Guillaume 2017 年 3 月 6 日
I suspect that Java is giving you the true screen size, whereas matlab and .Net is giving you the screen size scaled by the DPI scaling (under set custom text size in the display control panel) which you probably have set to 'Larger - 150%'.
A 'DPI aware' application should use the latter size because that's the size of the canvas that Windows provides to application for displaying stuff.

サインインしてコメントする。


Image Analyst
Image Analyst 2015 年 1 月 23 日
It's fine for me. It matches up fine.

Matt
Matt 2017 年 3 月 6 日
編集済み: Matt 2017 年 3 月 6 日
Further to Guillaumes comment, which I hadn't actually seen.
I have just had this issue myself. Screensize returned a size in pixels/resolution of 1536x864 on a screen I knew was 1080p capable and set to 1920x1080 resolution.
I right clicked on my Matlab shortcut, and ticked "Disable Display Scaling on High DPI Settings" and now screensize is returned as 1920x1080 as I would expect.
  1 件のコメント
Guillaume
Guillaume 2017 年 3 月 6 日
and now screensize is returned [] as I would expect
Well, both results are actually as expected. When you have display scaling on, the effective resolution of 1536x864 pixels. That is, if you were to draw a rectangle that size in matlab it would fill up the screen. Windows rescale that rectangle to 1920x1080 to compensate for the higher DPI.
If you turn display scaling off, Windows does no virtualisation, so you indeed need 1920x1080 pixels to fill the screen. The downside is that text may be harder to read as it is smaller.
In the end, as I commented, the size reported by Matlab or .Net is the one you should use, regardless of the actual number of pixels of your screen. The size reported by Java is actually less useful.

サインインしてコメントする。


Petorr
Petorr 2017 年 12 月 13 日
I had a similar issue; I think it was because I un-docked my laptop and then re-docked it (I have a dual-monitor display dock), and the monitor info may have not updated accordingly. I restarted matlab and things returned to normal. I am using get(0,'MonitorPositions').

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by