  For a growing number of applications such as cellular, peer-to-peer, and
sensor networks, efficient error-free transmission of data through a network is
essential. Toward this end, K\"{o}tter and Kschischang propose the use of
subspace codes to provide error correction in the network coding context. The
primary construction for subspace codes is the lifting of rank-metric or matrix
codes, a process that preserves the structural and distance properties of the
underlying code. Thus, to characterize the structure and error-correcting
capability of these subspace codes, it is valuable to perform such a
characterization of the underlying rank-metric and matrix codes. This paper
lays a foundation for this analysis through a framework for classifying
rank-metric and matrix codes based on their structure and distance properties.
  To enable this classification, we extend work by Berger on equivalence for
rank-metric codes to define a notion of equivalence for matrix codes, and we
characterize the group structure of the collection of maps that preserve such
equivalence. We then compare the notions of equivalence for these two related
types of codes and show that matrix equivalence is strictly more general than
rank-metric equivalence. Finally, we characterize the set of equivalence maps
that fix the prominent class of rank-metric codes known as Gabidulin codes. In
particular, we give a complete characterization of the rank-metric automorphism
group of Gabidulin codes, correcting work by Berger, and give a partial
characterization of the matrix-automorphism group of the expanded matrix codes
that arise from Gabidulin codes.
