MATLAB: I have a matrix which is 1000 columns and 3621 rows, how to take the mean of each row matrixmean Basically I want to turn my matrix from dimensions 3621×1000 into 3621×1 by taking the means of each row. Thank you for your help. Best Answer In general, if you have a matrix A and want to take the mean across a certain dimension, dim, you should use mean(A,dim).dim = 1 gives the mean for each column, dim = 2 gives the mean for each row, and so on.Here's an example for your case:M = rand(3621,1000);size(M)ans = 3621 1000meanOfEachRow = mean(M,2)size(meanOfEachRow)ans = 3621 1 Related SolutionsMATLAB: Rows a = rand(1000,5);b = min(a,[],2); MATLAB: Matrices, collect, rows, columns C(:,:,1)=A+B;c=2;while nnz(C(:,:,end)>0)==numel(C(:,:,end)) C(:,:,c)=C(:,:,c-1)+B; c=c+1;endC=C(:,:,1:end-1); Related QuestionPlot title divided into rows, why?!Merging table rows, keep all columnsMatrix element counting by rows, histograms, etc.
Best Answer