The previous answer is the simplest way, it will represent transpose by an n^2$n^2$ by n^2$n^2$
permutation matrix P$P$, where P^2 = I$P^2 = I$. I think the matlab command you need is vec(A)vec(A)
,which which converts A$A$ to a vector.
For another viewpoint we "recall" that each linear map from the vector space M$M$ of n times n$n \times n$ matrices to itself is determined by two sequences of n$n$ by n$n$ matrices A_1,...A_r$A_1,\dots, A_r$ and B_1,...,B_r$B_1,\dots ,B_r$, where r \le n$r \le n$. The corresponding linear map sends a matrix X$X$ to
\sum_i A_i XB_i^T.
$$\sum_i A_i XB_i^T.$$
(This is what a physicist would call a super-operator.) This is all basic tensor algebra, but you could prove my claim by showing the maps just defined form a vector space of dimension n^4$n^4$, and so must coincide with the the space of linear maps from M$M$ to itself.
If the map is invertible and preserves multiplication, only one term is needed in the sum. The trace map is invertible but does not preserve multiplication, so more than one term is needed. Now your problem to choose the A_i's$A_i$'s and B_i's$B_i$'s so that the matrix E_{i,j}$E_{i,j}$ is mapped to E_{j,i}$E_{j,i}$. I am afraid I am leaving this an exercise.