The diagonal of an NxN matrix is always N.
The diagonal of a non-square matricies is min(nrows, ncols)
.
Matricies can have units (e.g. stiffness matrix in finite elements for mechanics has physical units of force/length), but I'm not sure how you mean it.