Get current figure size in MATLAB

Darcy picture Darcy · Sep 22, 2015 · Viewed 27.3k times · Source

Simple question: How do you get the current figure size in MATLAB?

Example:

figure(1)
[width, height] = ****some function I'm not aware of****

Googling this always returns how to change the window size but not how to just get the current window size.

Any help is appreciated.

Cheers

Answer

Luis Mendo picture Luis Mendo · Sep 22, 2015
pos = get(gcf, 'Position'); %// gives x left, y bottom, width, height
width = pos(3);
height = pos(4);