Sum of matrix elements

3 次查看(过去 30 天)
I have that matrix
p=[4 9 3 3 6 8 8 12 6]
and i want to reach that one
k=[4 13 16 19 25 33 41 53 59]
I made with for loop but is seems like
k=[13 16 19 25 33 41 53 59 ]
how can i fix it?

采纳的回答

Stephen23
Stephen23 2019-5-29
编辑:Stephen23 2019-5-29
>> k = cumsum(p)
k =
4 13 16 19 25 33 41 53 59

更多回答(1 个)

ES
ES 2019-5-29

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by