NetLogo 7.0.0-beta2:

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