I want to get the upper triangle from a matrix. MATLAB have the functions tril
and triu
, unfortunately they give the wrong triangle. I'm looking for following triangle, is there a command for it or must it be a loop? If so, how does it look?
test=[1 1 1; 1 1 0; 1 0 0];