The previous answer is the simplest way, it will represent transpose by an $n^2$ by $n^2$
permutation matrix $P$, where $P^2 = I$. I think the matlab command you need is vec(A)
, which converts $A$ to a vector.
For another viewpoint we "recall" that each linear map from the vector space $M$ of $n \times n$ matrices to itself is determined by two sequences of $n$ by $n$ matrices $A_1,\dots, A_r$ and $B_1,\dots ,B_r$, where $r \le n$. The corresponding linear map sends a matrix $X$ to
$$\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$, and so must coincide with the the space of linear maps from $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 and $B_i$'s so that the matrix $E_{i,j}$ is mapped to $E_{j,i}$. I am afraid I am leaving this an exercise.