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]

 採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 8 月 26 日
編集済み: KALYAN ACHARJYA 2019 年 8 月 26 日

0 投票

>> 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)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

タグ

質問済み:

KF
2019 年 8 月 26 日

コメント済み:

KF
2019 年 8 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by