- Design the app within the smaller screen size, in the OpeningFcn read the screen size and make the figure proportionately larger, then use normalized units or write a sizechangedfcn to resize the content.
- Use the Figure's WindowState property to maximize the figure in the OpeningFcn
Screen Resolution Limit to Figure Size
29 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Wick
il 30 Apr 2018
Commentato: Fabiano Baroni
il 24 Giu 2021
I'd like to make a bit of code to create images targeted at a 4k display. Unfortunately, I don't own a 4k display. I do, however, have 3 1080 screens. Ordinarily I set them up in a row so my screen appears to MATLAB to be 1080 x 5760.
In this configuration if I run the below code with screen_fraction set to 1 or greater the images created are 1014 high (the maximum sized image always seems to have 66 fewer pixels than the apparent screen size).
If I tell Windows the displays are actually in a diagonal before starting MATLAB I can create a figure 2862 x 5088 before getting a java error.
Obviously then, MATLAB is limiting the figure size to the physical screen sizes but is capable of working with much bigger "displays."
The MonitorPositions and ScreenSize properties of get(groot) are read-only so I can't change them. Is there any other way to work around the connection to the physical size of the monitors?
Yes, I could use imwrite or print to work around this but I'd like to avoid that if possible.
Thanks in advance.
clearvars
screen_fraction = .5;
monitor_size = [1920 1080];
figure_pixels = fix(screen_fraction * monitor_size);
figure_offset = [1.25 0.25] .* monitor_size;
set(gcf,'units','pixels','Position',[figure_offset figure_pixels]);
% something to plot here
[XX,YY,ZZ] = peaks(25);
h = surf(XX,YY,ZZ);
F2I = frame2im(getframe(gcf));
target_size = fliplr(figure_pixels)
actual_size = size(F2I(:,:,1))
0 Commenti
Risposta accettata
Rajesh Balagam
il 11 Mag 2018
At present it is not possible to create a MATLAB figure window that is larger than the connected screen size. This is a constraint enforced by the OS/Window Manager.
If you want the app to resize based on the actual screen size (e.g. when connected to a 4k display), you can try the following workarounds:
2 Commenti
Fabiano Baroni
il 24 Giu 2021
You can try using xvfb-run for a virtual framebuffer. For example, for creating a very wide virtual screen:
xvfb-run --server-args="-screen 0 20480x1152x24" matlab -softwareopengl < script.m
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!