basic question: how do i keep counting up numbers in a vector?

for example i have a vector A=[2 3 2 3 2 3] and i want that every number counts up ?periodically? so i get B = [2 5 7 10 12 15]. i want to do this with some of my data so i can plot it on the Y axis of a graph. what am i supposed to call this way of processing and what would the code look like.

 採用された回答

Adam
Adam 2016 年 5 月 17 日

0 投票

>> a = [2 3 2 3 2 3];
>> B = cumsum( a )
B =
2 5 7 10 12 15

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeVehicle Dynamics Blockset についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by