%% Extract Upper Triangular Portions of Matrix
% Create a 4-by-4 matrix of ones. Extract the upper triangular portion.

A = ones(4)

%

B = triu(A)

%
% Extract only the elements above the main diagonal.

C = triu(A,1)

% Copyright 2012 The MathWorks, Inc.