The Octave Forge package repository is no longer actively maintained. Please find Octave Packages at https://packages.octave.org.

Navigation

Operators and Keywords

Function List:

C++ API

Method on @infsup: triu (A)
Method on @infsup: triu (A, k)
Method on @infsup: triu (A, k, "pack")

Return a new matrix formed by extracting the upper triangular part of the matrix A, and setting all other elements to zero.

The second argument is optional, and specifies how many diagonals above or below the main diagonal should also be set to zero.

If the option pack is given as third argument, the extracted elements are not inserted into a matrix, but rather stacked column-wise one above other.

See also: @infsup/tril, @infsup/diag.

Package: interval