If I have a 2000 x 130 matrix, how do I convert it to a 500 x 130 matrix by adding all four rows together by using Matlab loop

1 次查看(过去 30 天)
.

采纳的回答

KSSV
KSSV 2022-1-12
编辑:KSSV 2022-1-12
A = rand(2000,130) ;
[r,c] = size(A);
nlay = r/4;
B = permute(reshape(A',[c,r/nlay,nlay]),[2,1,3]);
iwant = reshape(sum(B),[],c) ;
  2 个评论
Haytham Ali
Haytham Ali 2022-1-12
@KSSV thank you
Can you tell me how to sum all 4 elements or rows
Since I want to calculate the average for each of the four elements by calculating their sum divided by their number

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by