%% Maximizing a Figure Using M-Code
% A couple of users have asked how they can maximize their figures
% automatically from m-code. The solution is extremely simple, requiring
% only the figure's position property to be setup.

%% Creating a Figure
% The code below simply generates a figure in it's default size.
peaks;
shading interp;
lighting phong;

%% Maximizing the Figure
% The figure can be maximized by setting up the figure's 'position'
% property correctly. The 'position' property is set to a vector value of
% the form: [Left Bottom Width Height]. So this property also sets the size
% the figure, by specifying the Width and Height values. In order to
% maximise the figure size we need to find the size of the computer screen.
% The code below sets the figure's size to that of the computer screen.

set(gcf,'position',get(0,'screensize'))