Summing the elements of an array while maintaining its size

1 vue (au cours des 30 derniers jours)
Lev Mihailov
Lev Mihailov le 17 Fév 2022
Modifié(e) : KSSV le 17 Fév 2022
There is an array of data, I need to sum it while maintaining the length of the array
a=[0 2 2 6]
Ineed=[0 2 4 10]
there are some functions for this or it will be necessary to write a cycle, I will be glad for any help

Réponses (1)

KSSV
KSSV le 17 Fév 2022
Modifié(e) : KSSV le 17 Fév 2022
a=[0 2 2 6];
Ineed=cumsum(a)
Ineed = 1×4
0 2 4 10

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by