n=5
A=zeros(n);
for i=1:n
    for j=1:n
        A(i,j)=j+(i-1)*n;
    end
end
A