File Exchange

image thumbnail

Maximize window

version 1.0.0.0 (1.59 KB) by Yuval Cohen
Maximize window size to fill the entire screen. Has learning capability.

0 Downloads

Updated 22 Mar 2005

No License

Maximize the size of figures and GUIs to fill the entire screen.

The function was tested under the following conditions:
screen resolutions:
[800x600]
[1024x768]
[1152x864]
[1280x960]
Matlab version: R12, R13
OS: WinXP

The function was calibrated to handle WinXP standard toolbar (at the bottom of the screen, one icon row) and standard screen (4x3 ratio - not wide).

If you are using different settings, the maximized figure size could be wrong. If you find yourself in such a position, fear not. Run the function in 'calibrate' mode to calibrate the settings.

The application will ask you to maximize a figure window manually and use these settings as a reference from now on.

2005-03-21 update - contribution of Tim Myers
Maximize can set the image to fill any portion of the screen.

Cite As

Yuval Cohen (2020). Maximize window (https://www.mathworks.com/matlabcentral/fileexchange/3812-maximize-window), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (27)

florisa

Hey,
this function works for me, but I got a little problem. When I click to resize the window to the my figure old size nothing happens. What should I try?

joo tan

i try use this program..but failed..what the value for (h)? still confuse..help me

Steven

You can also add

elseif screen(3) == 1680
set(gcf,'Units','normalized','Position',[0.00 0.0267 1.0 0.9095])

works for me !

Well done! Works just as a maximized window does, without the window being "maximized" in Windows terms.

James Huber

Also, try it this way:

scrsz=get(0,'ScreenSize');
maxWindow=[1 31 scrsz(3) scrsz(4)-104];
%31 happens to be the pixel width of the task bar and 73 was the space required for the figure toolbar (73+31=104)
h=figure(17);
%choose any number that is available
set(h,'Name','MyGraphTitle','NumberTitle','off','Position',maxWindow)
%maxWindow is in the form [distance-from-left distance-from-bottom window-width window-height]

Also, you can find your maximized position this way:
figure(1);
%manually maximize the window with the mouse here
maxWindow=get(1,'Position')

You can deterimine the default window size this way:
get(0,'Position)

Serge Thill

Just for information, if the purpose is simply to maximse a window, these two lines (slightly modified from the Matlab help) should also do the job:
scrsz = get(0, 'ScreenSize');
figure('Position', [1 scrsz(4) scrsz(3) scrsz(4)]);

Junior JR

Excellent

Wenying Shou

Nice!

Emma Peeling

This is excellent... just what I need and works exactly as described

yaniv the magnificent

Tevorah :)
It was great...

thanks a lot.
Yaniv and Amit.

Kiran Misra

Awesome .. saved my butt.

Julie Meng

Beautiful!!

Florian Weichert

Really useful.

Kjetil Sæheim

Thanks!

Kai-Cheng Hu

Thank you so much. It works properly on my PC . And I also learned some skills form your code(ex:an undocumented fig property-- ActivePositionProperty d). That is so perfect than I wrote.

Alfredo Fernandez

David Babineau

Excellent! Very easy to use and handy.

Tim Myers

I tried a few different functions all claiming to do the same thing. This function is the only one that worked properly on all screen resolutions. Hopefully, Matlab will include this type of function in a near-term release.

Ugo Di Girolamo

does not handle my office toolbar, though

Muni Gangabathina

Cool. This is exactly what I wanted!

Jim Bean

Marc Franco

Works great. Good job!

Aaron Luttman

This is exactly what I have needed for opening and closing a lot of different plot windows, since I always want them maximized. This is a nice easy way to do it, and it works exactly as it says.

Brahim Hamadicharef

Thanks for this !
I do often prefer FULL SCREEN !

Brahim

Kousuke Miyahara

Works as advertized. The only file I found here that makes the figure fill the entire screen. Even thought the figure is not "Maximized", the size and position are exactly the same.
Well done

Updates

1.0.0.0

New feature - resize image to fill a portion of the screen

Updated calibration process.

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: subfig, Simulation of Random Walk