The $i,j$-th entry of $MM^T$ is the dot product of the $i$-th row of $M$ with the $j$-th column of $M^T$ (which is the $j$-th row of $M$).
So, the $i$-th entry on the diagonal of $MM^T$ is the $i$-th row of $M$ dotted with itself, which is the norm squared of the $i$-th row.
* * *
Note that if you're actually wanting to calculate the norm of each row, this is a slow way to do it, cause you'll do the $i$-th row dotted with the $j$-th row for $i \
eq j$ as well (this has the complexity of matrix multiplication; if $A$ is m x n, this is $O(m^2n)$ in complexity, roughly (i.e. scales superlinearly in the number of entries in the matrix). A cleaner way is to do
sqrt(sum(M.^2,2))
which is $O(mn)$, i.e. scales linearly with the number of entries in the matrix.