MATLAB: How to Make a board in Matlab

gui

I want to make a n x n size board in Matlab (n is a user input). How do I do this?
I want it to appear as:
1 2 3 4 5 6 7 8 9 10
1 x x x x x x x x x x
2 x x x x x x x x x x
3 x x x x x x x x x x
4 x x x x x x x x x x
5 x x x x x x x x x x
6 x x x x x x x x x x
7 x x x x x x x x x x
8 x x x x x x x x x x
9 x x x x x x x x x x
10 x x x x x x x x x x

Best Answer

Krish - you could consider using a cell array to represent the characters in your board. For example,
n = 12;
board = cell(n+1,n+1);
% initialize the board
for u=1:n+1
for v=1:n+1
if u==1
if v<=n
board{u,v+1} = v;
board{v+1,u} = v;
end
elseif v==1
% do nothing
else
board{u,v} = 'x';
end
end
end
would create a board similar to what you are requesting. I noticed that you tagged your question with "GUI". Were you hoping to create some sort of GUI with the above board embedded in it?