F}_{q}}$-subspaces of $V$ and rank metric codes. We start by generalizing the construction of rank-metric codes $\mathcal{C}_U$ provided in [@CSMPZ2016] and defined by an ${{\mathbb F}_{q}}$-subspace $U$ of $V$. We detect those $U$’s such that $\mathcal{C}_U$ is MRD; among these are the maximum $1$- and $(r-1)$-scattered subspaces. Actually, the code $\mathcal{C}_U$ is MRD exactly when $U$ is the dual of a $h$-scattered subspace of dimension $\frac{rn}{h+1}$, for some $1\leq h\leq r-1$. Therefore, our connection extends and unifies the ones in [@Sheekey; @CSMPZ2016; @PZ; @ShVdV; @Lunardon2017]. To this aim, we exhibit two characterizations of $h$-scattered subspaces of dimension $\frac{rn}{h+1}$, which are of independent interest. Moreover we prove that, up to equivalence, the MRD codes of type $\mathcal{C}_U$ are exactly the ${{\mathbb F}_{q}}$-linear MRD codes with parameters $(\frac{rn}{h+1},n,q;n-h)$ and maximum right idealiser.

An essential though difficult task is to decide whether or not two rank metric codes with the same parameters are equivalent (especially when they correspond to non-square matrices). A remarkable aspect of the MRD codes that we construct is that we are able to determine one of their idealisers; this allows to prove that some of them are not equivalent to punctured generalized Gabidulin codes nor to punctured generalized twisted 