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 日

1 投票

>> k = cumsum(p)
k =
4 13 16 19 25 33 41 53 59

その他の回答 (1 件)

ES
ES 2019 年 5 月 29 日

0 投票

cumsum(p)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2019 年 5 月 29 日

回答済み:

ES
2019 年 5 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by