Monday, June 30, 2008

Full Screen Figures in Matlab

Matlab's native figure command does not give you an option to make your figure full screen in 1 step. Instead first you have to find the screen resolution and then give your figure command the size of the screen.

First thing you want to do is:

screen_size = get(0, 'ScreenSize');

This will return a 4 element array: (left, bottom, width, height);
The ones we are interested are the "width" and "height".

Now we have the size of the screen, we can make our figure full screen:

f1 = figure(1);
set(f1, 'Position', [0 0 screen_size(3) screen_size(4) ] );

Now you should have a figure that is full screen.

22 comments:

Anonymous said...

Useful. Thanks.

Anonymous said...

Very useful indeed, thanks!

Doesn't necessarily work like this with multiple monitors, esp. if they have different shapes, for that (prob somewhat rare) case check here:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/167766
or use a search engine...

Anonymous said...

Easier yet, just paste the following above your plot commands:

figure('Units','normalized','Position',[0 0 1 1])

I'm not sure how this will work with multiple screens...

Anonymous said...

i wanted to know that is it possible to display it in full screen as in the full screen when we watch movies can the same be done for videos in maltab?

Anonymous said...

YES! Thank you for posting this, I've done quite enough screwing around with MAtlab already today.

Anonymous said...

Great. Thanks

Anonymous said...

cheers, man.

DAvid said...

Thanks

Anonymous said...

I need a real ful screen, I mean no boarders. Thank you.

Joseph said...

Grazie! it works fine..

Joseph said...
This comment has been removed by the author.
Anonymous said...

nice, thx

robinpmooney said...

That worked a treat! thank you :D

Anonymous said...

For true full-screen, try this:
http://www.mathworks.com/support/solutions/en/data/1-1AZWA/

Anonymous said...

Check also this option out in order to obtain your figure plot in full screen size.

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

Anonymous said...

Hi, I've tried both the original method posted and that involving figure('Units','normalized','Position',[0 0 1 1]). The second works in terms of getting the full screen because I have multiple figures plotted together, but it opens a new figure window each time. Is there a way around this?
Thanks!

Bilge Tutak said...

I don't remember for sure, but I think calling
set(figure_handle,'WindowStyle','docked')
will dock all the figures created by the matlab to be in the same window.

Anonymous said...

Thanks DUDE!! :D

Anonymous said...

Eyvallah hoca!!! Hurmetler! :)

Beverly said...

Exactly what I needed! Thanks!

יורי said...

Very good and useful explanation. Thanks a lot!!

יורי said...

Very good and useful explanation. Thanks a lot!!