Average the 3rd dimension in a matrix

3 Ansichten (letzte 30 Tage)
Jonas Damsbo
Jonas Damsbo am 4 Jan. 2019
Kommentiert: Jonas Damsbo am 4 Jan. 2019
I have a 360x181x360.
I want to average the 3rd dimension with 4, so I get a new matrix like 360x181x90.
How can I do that?

Akzeptierte Antwort

Bruno Luong
Bruno Luong am 4 Jan. 2019
Bearbeitet: Bruno Luong am 4 Jan. 2019
Mean every 4 indices of the third dimension
A=rand(360,181,360);
[m,n,p] = size(A);
m = mean(permute(reshape(A,m,n,4,[]),[1 2 4 3]),4)

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices 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!

Translated by