Incorrect screensize in inches when using MATLAB via remote desktop and a high-DPI laptop causes figures to appear off screen
Ältere Kommentare anzeigen
I'm trying to create some MATLAB GUIs which will be used by several different people with different computer specifications, but all accessing via a Windows 2012 remote desktop. My laptop is 3840x2160 pixels and 16"x9". When I run the following code on my local version of MATLAB I get the correct screensize, but when I run it on the remote desktop, I get 40"x22.5":
set(0,'units','inches');
inch_SS = get(0,'screensize')
I understand that this is because MATLAB assumes 96 pixels/inch, and custom figures do appear the same size between my version of MATLAB and the remote desktop version, but on the remote desktop 'centered' figures appear off screen, since MATLAB thinks my screen is 40" wide. I can of course hardcode a figure position that centers the figure for my laptop, but then the figures will be off-center for other users who are not using high-DPI computers to access the program.
The MATLAB editor itself is not cut-off on the remote desktop version, so it 'knows' on some level how big my screen actually is, but I'm not sure how to access that information besides the code above, which gives an inaccurate output. I've tried creating a fullscreen figure and then retrieving the fig.Position information, but that just returns the default figure size and location:
fig = uifigure('Name','Testing Display');
disp(fig.Position)
fig.WindowState = 'Fullscreen';
disp(fig.Position)
fig.WindowState = 'Maximized';
disp(fig.Position)
I'm not set on using 'uifigure', but I would prefer to create the GUIs programatically.
Antworten (0)
Kategorien
Mehr zu Environment and Settings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!