I want to write MATLAB code that includes an array consisting of all $2 \times 2$ square matrices whose elements are elements of $\Bbb{Z}_2= \{0,1\}$, e.g.,
$$ \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix},\quad \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix},\quad \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix},\quad \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix},\quad \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix},\quad \begin{pmatrix} 1 & 1 \\ 0 & 0 \end{pmatrix},\quad \cdots$$
And how can I generalize the same thing with $\Bbb{Z}_2$ for $n \times n$ square matrix? Please help!