use for loop to write a sum function to achieve halfsum

1 回表示 (過去 30 日間)
paul mary
paul mary 2019 年 1 月 28 日
回答済み: Stephan 2019 年 1 月 28 日
this is a task of mooc course, please help me. It spent me a lot of time.
微信截图_20190128224908.png

採用された回答

Stephan
Stephan 2019 年 1 月 28 日
Hi,
note the triu function:
A = [1 2 3; 4 5 6; 7 8 9]
result = sum(triu(A),'all')
Best regards
Stephan

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by