This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Upper triangular part of matrix


U = triu(X)
U = triu(X,k)


U = triu(X) returns the upper triangular part of X.

U = triu(X,k) returns the element on and above the kth diagonal of X. k = 0 is the main diagonal, k > 0 is above the main diagonal, and k < 0 is below the main diagonal.



ans = 

    1    1    1    1
    1    1    1    1
    0    1    1    1
    0    0    1    1

Extended Capabilities

See Also


Introduced before R2006a

Was this topic helpful?