MATLAB: Means of the 3rd dimension of a matrix 3rd dimension AA = rand(3) I want a 2d matrix BB containing means of 3rd dimension of matrix A How I can do this smartly? Thanks Best Answer BB = mean(A, 3); Related SolutionsMATLAB: Mean of 3rd dimension A = [1 2 3; 4 5 6; 7 8 9];A(:,:,2) = [10 11 12; 13 14 15; 16 17 18];A(:,:,3) = [19 20 21; 22 23 24; 25 26 27];A(:,:,3) = [28 29 30; 31 32 33; 34 35 36];meanA = mean(A(:,:,1:2),3);Take a look at this exampl. This will help you out!also you should see the function "mean":https://www.mathworks.com/help/matlab/ref/mean.html?searchHighlight=mean&s_tid=doc_srchtitle&requestedDomain= MATLAB: Average the 3rd dimension in a matrix 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) Related QuestionStandard deviation of a 3d matrix
Best Answer