  Let $F$ be a field and let $F^{r\times s}$ denote the space of $r\times s$
matrices over $F$. Given equinumerous subsets $\mathcal{A}=\{A_i\mid i \in
I\}\subseteq F^{r\times r}$ and $\mathcal{B}=\{B_i\mid i\in I\}\subseteq
F^{s\times s}$ we call the subspace $C(\mathcal{A},\mathcal{B}):=\{X\in
F^{r\times s}\mid A_iX=XB_i\ {\rm for }\ i\in I\}$ an \emph{intertwining code}.
We show that if $C(\mathcal{A},\mathcal{B})\ne\{0\}$, then for each $i\in I$,
the characteristic polynomials of $A_i$ and $B_i$ and share a nontrivial
factor. We give an exact formula for $k=\dim(C(\mathcal{A},\mathcal{B}))$ and
give upper and lower bounds. This generalizes previous work in this area.
Finally we construct intertwining codes with large minimum distance when the
field is not `too small'. We give examples of codes where $d=rs/k=1/R$ is large
where the minimum distance, dimension, and rate of the linear code
$C(\mathcal{A},\mathcal{B})$ by $d$, $k$, and $R=k/rs$, respectively.

Combinatorics