Square matrix input, output same elements in upper right triangle

Any pointers on this one? I'm not looking for just an answer, I want to understand why and how it works so I can use this in the future. Matrix B referenced in the question is B=[-6 0 4; -2 8 3; 7 0 1]

 Risposta accettata

>> magic(6);
>> triu(ans);
Here
B=[-6 0 4; -2 8 3; 7 0 1];
result=triu(B)
Also, you can do the same in multiple ways (without inbuilt function)

Più risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Centro assistenza e File Exchange

Tag

Richiesto:

KF
il 26 Ago 2019

Commentato:

KF
il 26 Ago 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by