Skip to main content

DiagSize

DiagSize returns the size of the diagonal. It works for both rectangle and square arrays.

For example,

ans = DiagSize(n=3, diagNo=1)

Returns the size of first super diagonal of a square matrix of shape (3,3).

And,

ans = DiagSize(n=3, diagNo=-1)

Returns the size of first sub diagonal of a square matrix of shape (3,3).

ans = DiagSize(m=4, n=7, diagNo = 1)

Returns the size of first super diagonal of a rectangle matrix of shape (4,7). Here m and n stand for number of rows and cols, respectively.