cumsum of a matrix

1 次查看(过去 30 天)
Mate 2u
Mate 2u 2012-5-25
Hi there I have a nxm matrix. I want to do the cumsum of each column, then all of them added up to give one total cumsum.
Any help?

回答(2 个)

Wayne King
Wayne King 2012-5-25
X = 1:100;
X = reshape(X,10,10);
X1 = cumsum(X(:));

the cyclist
the cyclist 2012-5-25
Is this what you mean?
M = rand(5,6);
S = sum(cumsum(M),2);
  1 个评论
Muhammad Furqan
Muhammad Furqan 2017-10-25
编辑:Muhammad Furqan 2017-10-25
M = rand(5,6); Mean that it creates random numbers of a matrix with 5 column and 6 rows. S = sum(cumsum(M),2); It generate commulative sum of the rows in one column. For example M = rand(2,3);
S = sum(cumsum(M),2); 1.02263280043603 2.03657698954441

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by