Navigation: Language Reference > Functions > Matrix >
y = trace(A);
Returns the sum of the diagonal elements of the matrix A.
A = [1,2,3;4,ramp(1),6];
y must be a scalar.