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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
.
0 Kommentare
Akzeptierte Antwort
KSSV
am 12 Jan. 2022
Bearbeitet: KSSV
am 12 Jan. 2022
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 Kommentare
KSSV
am 12 Jan. 2022
Sum is already included in the code.... To get the average just use mean. Read about this function.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!