MATLAB: Sum matrix column to get another matrix MATLABmatrixsum I have a matrix G 1441x365x91(MxNxL), I need another matrix D 1441×91 (MxL), whereby N must be summed. Shortly its a 1441×91 data over 365 days, and I need the 1441×91 data which is yearly sum. thanks Best Answer G1 = squeeze(sum(G,2)); Related SolutionsMATLAB: MAtrix Sum along dimension 2 (columns):sum(A,2) MATLAB: Matrix x = randi([-1 1],1,100);percent1 = 100*(length(x(x==1))/numel(x));percentminus1 = 100*(length(x(x == -1))/numel(x));Another waysum(bsxfun(@eq,x,1))sum(bsxfun(@eq,x,-1)) Related QuestionHelp with matrix manipulation in matlabMatrixMatrixMatrix
Best Answer