What really is codomain? Pretty simple: 
Is the codomain of a matrix simply the number of rows, or is it the rank? (The linearly independent rows?)
Maybe I can ask about some examples. Here are the questions and my answers.
 A: I'm assuming you are referring to the codomain when we interpret the matrix as a function, as I am not aware of any other connection between codomains and matrices.
If so, then the dimension of the codomain is given by the rank of the matrix, and the codomain itself is the span of the linearly independent rows or columns.
Remember that a matrix is just a representation. In this case we use a matrix $M$ to represent a linear function:
$$ M:\mathbb R^n\rightarrow \mathbb R^m.$$
So $M$ sends $a\in \mathbb R^n$ to $M(a)=b\in 
\mathbb R^m$. Practically (and with finite dimensions), this comes down to matrix multiplication: $Ma=b$ or $a^TM=b^T$, depending on whether you represent $\mathbb R^n$ and $\mathbb R^m$ with rows or columns.
Now, the codomain is the collection of vectors that are the image under $M$ of some $a\in \mathbb R^n$, that is, it is the collection 
$$\{b\in\mathbb R^m\mid b=M(a) \text{ for some }a\in\mathbb R^n\}.$$
It can be shown that this collection in fact is a subspace of $\mathbb R^m$, and that it is spanned by the column- or rowvectors, depending on your choice of representation. 
