Sum of matrix elements

3 vues (au cours des 30 derniers jours)
Afiye Havva Geçgel
Afiye Havva Geçgel le 29 Mai 2019
Réponse apportée : ES le 29 Mai 2019
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?

Réponse acceptée

Stephen23
Stephen23 le 29 Mai 2019
Modifié(e) : Stephen23 le 29 Mai 2019
>> k = cumsum(p)
k =
4 13 16 19 25 33 41 53 59

Plus de réponses (1)

ES
ES le 29 Mai 2019

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by