MATLAB: How to calculate the mean of each row from several columns columnsmeanrows I have 3 columns as three separate variables in the workspace. I want to find the mean of each row to create a new column of averaged values. Best Answer a = rand(10, 1);b = rand(10, 1);c = rand(10, 1);m = (a + b + c) / 3Or less efficient:m = mean([a, b, c], 2) Related SolutionsMATLAB: Mean of Matrix Rows The row means would be calculated as the mean of dimension 2. Try this: A = rand(5);Anew = A - mean(A,2);Check = mean(Anew,2) % Confirm: Mean = 0 MATLAB: Calculate the mean of several columns One way is simply with a for loopA = randn(100,112);for nn = 0:15 B(:,nn+1) = mean(A(:,nn*7+1:(nn+1)*7),2); end Related QuestionHow to calculate varianceMeanHow to take the mean of each row every third columnMena of each row in matrix
Best Answer