Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically maximize a figure

I am creating some figures in MATLAB and automatically save them to files. The problem that by definition the images are small. A good way to solve my problem by hand is to create an image (figure), maximize it, and save to a file.

I am missing this step of automatically maximize a figure.

Any suggestions? Up till now I only found this:

http://answers.yahoo.com/question/index?qid=20071127135551AAR5JYh

http://www.mathworks.com/matlabcentral/newsreader/view_thread/238699

but none are solving my problem.

like image 593
Salvador Dali Avatar asked Mar 08 '13 03:03

Salvador Dali


People also ask

How do I save a full figure in Matlab?

To save the current figure, specify fig as gcf . saveas( fig , filename , formattype ) creates the file using the specified file format, formattype .

How do I open the figure window in Matlab online?

In Figures, open a figure. Tap Show Data Cursor at the top of the screen.


2 Answers

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.

like image 188
yuk Avatar answered Oct 05 '22 20:10

yuk


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

like image 44
The-Duck Avatar answered Oct 05 '22 21:10

The-Duck