NetLogo 7.0.1:

matrix:trace

matrix:trace matrix

Reports the trace of the matrix, which is simply the sum of the main diagonal elements.

Take me to the full Matrix Extension Dictionary