MATLAB: I want to make every row have same number

matrixnn

N=input('input size of matrix N*N give N = ');
for i=1:N
A=[i*ones(1,N)]
end
the result is input size of matrix N*N give N = 3
A =
1 1 1
A =
2 2 2
A =
3 3 3
but I want A =
1 1 1
2 2 2
3 3 3

Best Answer

Try
A = repmat((1:N)', [1, N])