Clear Filters
Clear Filters

I needed matlab code for cumulative sum of column vector

2 views (last 30 days)
I needed matlab code for cumulative sum of column vector

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 27 Dec 2014
Edited: Azzi Abdelmalek on 27 Dec 2014
yourarray=[1 2 3 4 5]
out=cumsum(yourarray)
  5 Comments
maha ismail
maha ismail on 27 Dec 2014
it doesn't work as I need I need to produce I column vector also not a scalar because I need cumulative sum for more colmun vector such that each row element of new column vector coming from current and previous element row of vectors
Azzi Abdelmalek
Azzi Abdelmalek on 27 Dec 2014
Edited: Azzi Abdelmalek on 27 Dec 2014
Maybe you need this
yourarray=[1 2 3;4 5 6]
out=cumsum(yourarray,1)
%or
yourarray=[1 2 3;4 5 6]
out=cumsum(yourarray,2)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!