MATLAB: How can one create this matrix

MATLAB

I want to create a matrix like
1 1
1 2
1 3
1 4
1 5
2 1
2 2
2 3
..
That is, I start from
grids=1:1:5
and I want to repeat this "grids" in the second column. Please advise.

Best Answer

[X, Y] = meshgrid(1:5);
[X(:), Y(:)]