Sum of matrix elements

조회 수: 3 (최근 30일)
Afiye Havva Geçgel
Afiye Havva Geçgel 2019년 5월 29일
답변: ES 2019년 5월 29일
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에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by