12

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

Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
Darcy
  • 619
  • 2
  • 5
  • 15
  • The methods you found use `set`... just use `get` instead. `h = get(gcf, 'Position');`, then look at the last two elements. – rayryeng Sep 22 '15 at 20:32

1 Answers1

21
pos = get(gcf, 'Position'); %// gives x left, y bottom, width, height
width = pos(3);
height = pos(4);
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147