<< moc_size_equal Matlab/Octave Compatibility toolbox moc_squeeze >>

Matlab/Octave Compatibility toolbox >> Matlab/Octave Compatibility toolbox > moc_spdiags

moc_spdiags

A generalization of the function 'diag'

Calling Sequence

[A, c] = moc_spdiags (v, c, m, n)

Description

A generalization of the function 'diag'. Called with a single input argument, the non-zero diagonals C of A are extracted. With two arguments the diagonals to extract are given by the vector C.

The other two forms of 'spdiags' modify the input matrix by replacing the diagonals. They use the columns of V to replace the columns represented by the vector C. If the sparse matrix A is defined then the diagonals of this matrix are replaced. Otherwise a matrix of M by N is created with the diagonals given by V.

Negative values of C represent diagonals below the main diagonal, and positive values of C diagonals above the main diagonal.

Examples

moc_spdiags (matrix (1:12, 4, 3), [-1 0 1], 5, 4)

Authors


Report an issue
<< moc_size_equal Matlab/Octave Compatibility toolbox moc_squeeze >>