MATLAB Answers

When I use use following code, why don't I get the desirable dimensions in my figure? (1cm x 2 cm)

5 views (last 30 days)
Yasith Amarasinghe
Yasith Amarasinghe on 29 Nov 2017
Answered: Sonam Gupta on 7 Dec 2017
x=0:1:10; y=0:.5:20; plot(x,y); set(groot,'defaultFigurePaperPosition','default') axis([0 10 0 20]) set(gcf,'Units','centimeters','position',[10 10 1 2])

  0 Comments

Sign in to comment.

Answers (1)

Sonam Gupta
Sonam Gupta on 7 Dec 2017
As stated by documentation at https://in.mathworks.com/help/matlab/ref/matlab.ui.figure-properties.html#property_d119e283324, you cannot specify the figure Position property when the figure is docked. So, make sure the figure is not docked.
In your case, you are not able to see the figure size to be 1cm X 2cm because the Windows operating system enforces a minimum window width and a maximum window size. If you specify a figure size outside of those limits, the displayed figure will conform to the limits instead of the size you specified.

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!