Diagonal

WMA link


Diagonal[m]

gives a list with the values in the diagonal of the matrix m.

Diagonal[m, k]

gives a list with the values in the k diagonal of the matrix m.

Get the superdiagonal:

Get the subdiagonal:

Get the diagonal of a nonsquare matrix: