Some examples:
Case 1: n*(n-1)
$\mathbb {R}^{5\times4}$
$$\begin{bmatrix}
{a_{00}}&{a_{01}}&{a_{02}}&{a_{03}}\\
{a_{10}}&{a_{11}}&{a_{12}}&{a_{13}}\\
{a_{20}}&{a_{21}}&{a_{22}}&{a_{23}}\\
{a_{30}}&{a_{31}}&{a_{32}}&{a_{33}}\\
{a_{40}}&{a_{41}}&{a_{42}}&{a_{43}}\\
\end{bmatrix}$$
The main order is along the diagonal(not the main diagonal) from top left to bottom right; among the elements of each secondary diagonal, if the distance of each element to the matrix diagonal is shorter, the priority is higher. So we got a sequence:
00
10 01
11 20 02
21 12 30 03
22 31 13 40
32 23 41
33 42
43
The general formula of n*(n-1) is quite easy to implement with a computer, but the general formula of n*(n-2) is much more confused.
Case 2: n*(n-2)
$\mathbb {R}^{5\times3}$
$$\begin{bmatrix}
{a_{00}}&{a_{01}}&{a_{02}}\\
{a_{10}}&{a_{11}}&{a_{12}}\\
{a_{20}}&{a_{21}}&{a_{22}}\\
{a_{30}}&{a_{31}}&{a_{32}}\\
{a_{40}}&{a_{41}}&{a_{42}}\\
\end{bmatrix}$$
As the same, we got:
00
10 01
11 20 02
21 12 30 (draw a vertical line form the element to the diagonal, so not 21 30 12)
31 22 40
32 41
42
$\mathbb {R}^{6\times4}$
$$\begin{bmatrix}
{a_{00}}&{a_{01}}&{a_{02}}&{a_{03}}\\
{a_{10}}&{a_{11}}&{a_{12}}&{a_{13}}\\
{a_{20}}&{a_{21}}&{a_{22}}&{a_{23}}\\
{a_{30}}&{a_{31}}&{a_{32}}&{a_{33}}\\
{a_{40}}&{a_{41}}&{a_{42}}&{a_{43}}\\
{a_{50}}&{a_{51}}&{a_{52}}&{a_{53}}\\
\end{bmatrix}$$
As the same, we got:
00
10 01
11 20 02
21 12 30 03
22 21 13 40
32 41 23 50
42 33 51
43 52
53
Case 3: m*n
$\mathbb {R}^{m\times{n}}$
$$\begin{bmatrix}
{a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\
{a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\
{\vdots}&{\vdots}&{\ddots}&{\vdots}\\
{a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}}\\
\end{bmatrix}$$
At last, how to find the general formula or use computer program to generate the sequence of $\mathbb {R}^{m\times{n}}$.