Automatically maximize a figure

This worked for me:

figure('units','normalized','outerposition',[0 0 1 1])

or for current figure:

set(gcf,'units','normalized','outerposition',[0 0 1 1])

I have also used MAXIMIZE function on FileExchange that uses java. This is true maximization.


For an actual Maximize (exactly like clicking the maximize button in the UI of OS X and Windows) You may try the following which calls a hidden Java handle

figure;
pause(0.00001);
frame_h = get(handle(gcf),'JavaFrame');
set(frame_h,'Maximized',1);

The pause(n) is essential as the above reaches out of the Matlab scape and is situated on a separate Java thread. Set n to any value and check the results. The faster the computer is at the time of execution the smaller n can be.

Full "documentation" can be found here