Returns diagonal elements of A as a vector
vecdiag(A)
A
Input square matrix or scalar
Can be used with a character matrix
diagonal elements of A as a vector
vecdiag(demomat(2,2))