use for loop to write a sum function to achieve halfsum

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by