use for loop to write a sum function to achieve halfsum

1 visualización (últimos 30 días)
paul mary
paul mary el 28 de En. de 2019
Respondida: Stephan el 28 de En. de 2019
this is a task of mooc course, please help me. It spent me a lot of time.
微信截图_20190128224908.png

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by