MATLAB: Remove the blank area surrounding the figure

checkerboardfigurefill figuremargins

My objective is to creat checkerboard and assign different values to white and black squares, the code is showed below. How can I I remove the blank area surrounding the figure, which means to enable the figure to fill the whole window. Thank you!!
K = checkerboard(500,1,1);
K(K>0)=1;
figure
imshow(K)
mask = K > 0;
K(mask) = 10;
K(~mask) = 100;

Best Answer

"How can I I remove the blank area surrounding the figure, which means to enable the figure to fill the whole window"
If you're refering to the figure window, here's a solution.
fh = figure();
fh.Position(3) = fh.Position(4); %make figure square
ax = axes('Units','Normalize','Position',[0 0 1 1]); %set axes to fill figure
K = checkerboard(500,1,1);
K(K>0)=1;
imshow(K,'Parent', ax) %specify axes