# MATLAB: How to create a chessboard of variable size from images of individual tiles

arraychessboardimageImage Processing Toolboxmatrix

I need to create a chessboard using MATLAB, by using given images of tiles. The main problem, of course, is that the dimensions of the board must be configurable by the user (though it must still be a square). I've tried:
1. Storing the images in a cell array (don't know how to display this). 2. Automating the concatenation of row vectors/cell arrays into a matrix via loops (can't store images in a vector; using a cell array in place of the vector turns the matrix into a cell array).
tile{6} = imread('tw.png','png');tile{5} = imread('twpw.png','png');tile{4} = imread('twpb.png','png');tile{3} = imread('tb.png','png');tile{2} = imread('tbpw.png','png');tile{1} = imread('tbpb.png','png');rc=input('Enter number of rows: ');board=cell(rc);for k=1:rc    for l=1:rc        if (mod(k,2)&&mod(l,2))||((mod(k,2)==0)&&(mod(l,2)==0))            if (k==1)||(k==2)                board{k,l}=tile{1};            elseif (k==(rc-1))||(k==rc)                board{k,l}=tile{2};            else                board{k,l}=tile{3};            end        else            if (k==1)||(k==2)                board{k,l}=tile{4};            elseif (k==(rc-1))||(k==rc)                board{k,l}=tile{5};            else                board{k,l}=tile{6};            end        end    endendimage(board)
And of course, using image on that gives "Numeric or logical matrix required for image CData" . The expected result would be a chessboard with a black tile in the top left corner, two rows of white pawns at the top and two rows of black pawns at the bottom.
I'm pretty much new to using MATLAB, so perhaps there was a function I missed…?

board=[board;row{1,:}];
board=[board;row];