Code covered by the BSD License  

Highlights from
maximize

4.5

4.5 | 19 ratings Rate this file 88 Downloads (last 30 days) File Size: 1.24 KB File ID: #25471

maximize

by

 

02 Oct 2009 (Updated )

Platform independent function to maximize a figure window.

| Watch this File

File Information
Description

This function maximizes MATLAB figures on any platform. It takes a figure handle as input. Note: it doesn't simply resize the figure to fill the screen.

It uses Java, therefore doesn't contain any mex or OS specific code.

Acknowledgements

Find J Obj Find Java Handles Of Matlab Graphic Objects inspired this file.

MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (25)
13 Nov 2014 Marcelo Soto Thompson  
08 Oct 2014 Oliver Woodford

Jeffrey: Are you using an older version? The current version has only 21 lines, and works in R2014b (albeit throwing a warning).

08 Oct 2014 Jeffrey Girard

This worked wonders for me in MATLAB 2014a, but it is currently returning the following error with MATLAB 2014b:

Undefined function 'abs' for input arguments of type 'matlab.ui.Figure'.

Error in num2str (line 66)
xmax = double(max(abs(widthCopy(:))));

Error in maximize (line 137)
windowname = ['maximize_',num2str(h(n))];

11 Jan 2014 Peter Nave  
10 Dec 2013 Dabbler

Thanks Mathworks, for automatically submitting my rating without allowing me to write a comment first.
Works with Matlab 2013b, but it generates null pointer exceptions when the figure's property 'Visible' is set to off.

Regards,
Dabbler

10 Dec 2013 Dabbler  
10 Dec 2013 Dabbler  
10 Dec 2013 Dabbler  
01 Dec 2013 Florian  
31 Jul 2013 Ben  
25 Feb 2013 Sauro Salomoni

Ingenious function. Thank for the author!
Now I need to replace many years of using the ugly set(gcf, 'units', 'normalized', 'outerposition', [0 0 1 1])... :)

25 Feb 2012 dave  
16 Dec 2011 Joao Henriques

Works as advertised, thank you!

26 Oct 2011 Lukas  
08 Jun 2011 Julián Francisco

Hi. Your application does not work if the visibility of the figure is off before
calling the mazimize function. I am trying to find a function that maximize the figure window through a smoothed optical transition. Thank you for your attention. Best regards.

15 Jan 2011 Mohammed El-Said

Works great,
Thanks for sharing...

15 Nov 2010 Craig

Worked very nicely for me on Win7 with 64-bit R2010b. I use it together with export_fig to automatically and consitently save high quality figure output.

Many thanks Oliver!

10 Jun 2010 Oliver Woodford

Joris: On the version of MATLAB I have I don't see this error with the latest version of maximize (updated 17th May 2010). Do you have the latest version? It specifically fixed the error you report.

10 Jun 2010 JdW

I encounter one issue using your maximize.m function, namely maximize throws exceptions when figure is not yet ready. I include an example:

Example that throws exceptions:
h = figure; maximize(h);

Not so nice looking solution:
h = figure; pause(0.01); maximize(h);

18 May 2010 Heinrich Acker  
17 May 2010 Heinrich Acker

It's nice to have a real maximize operation without rezising, calling executables or the like. There is one issue, however:

If there is no figure, 'maximize' causes exceptions and makes all subsequent figure or plot operations fail, until the graphic system is sort of reset, e.g. by 'close all'. Tested on R2007b.

14 May 2010 JdW

Exactly what I whas looking for. I always did resizing to fill the screen, but this works so much nicer.

21 Apr 2010 Carsten Hoever  
19 Apr 2010 Oliver Woodford

Sherif: I've tested this function under several different versions of Matlab and OS's, and it works fine on all of them. If it genuinely doesn't work for you then can I suggest you send me a much more detailed bug report (e.g. Matlab version & OS, error message etc.) via the Contact Author link on my Author page. Posting requests for help here isn't what this comments section is for.

18 Apr 2010 Sherif Elnabarawy

i am wondering why all this code and functions for this simple thing , just need to maximize the gui automatically when loading , all codes and functions didn't work perfectly with me , any help ?
thanks a lot,
Sherif Elnabarawy.

Updates
13 May 2010

Removed dependency on jFindobj, using an idea based on comments by Yair Altman on the newsgroup.

17 May 2010

Fix bug reported by Heinrich Acker (thanks!).

16 Jan 2013

Acknowledge findjobj.

Contact us