Sum of defined portion of a 3D matrix
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Matt
am 22 Sep. 2015
Kommentiert: Stephen23
am 22 Sep. 2015
Hello,
I would like to sum different layers of a 3D matrix, but I don't know an easy way of doing it. Basically what I would like to do is this:
matrix1=sum(timematrix(:,:,1:3))
"timematrix" is a 1x1000x5 matrix and I would like to compute the sum of the first 3 layers. Using the following command works:
matrix1=timematrix(:,:,1)+timematrix(:,:,2)+timematrix(:,:,3)
Thanks in advance!
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 22 Sep. 2015
matrix1 = sum(timematrix(:,:,1:3), 3);
1 Kommentar
Stephen23
am 22 Sep. 2015
This is explained perfectly in the documentation:
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!