- 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
조회 수: 30 (최근 30일)
이전 댓글 표시
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
채택된 답변
Rajesh Balagam
2018년 5월 11일
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
Fabiano Baroni
2021년 6월 24일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!