I needed matlab code for cumulative sum of column vector

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 27 Dez. 2014
Bearbeitet: Azzi Abdelmalek am 27 Dez. 2014
yourarray=[1 2 3 4 5]
out=cumsum(yourarray)

5 Kommentare

I need matlab such that for I=1 :4 s=cumsum (q(:,I)) End
I know cumsum deal with row vector not column vector
yourarray=[1 ;2; 3; 4; 5] % a column vector
out=cumsum(yourarray)
I ll try it
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
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)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 27 Dez. 2014

Bearbeitet:

am 27 Dez. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by