MATLAB: Sum all the Channels in matrix MATLABmatrix operiationmerge the channelssummationwithout loops. Hello everyone, Let say I have a matrix M of 100 x 100 x 5. How can I sum all the channels of M and get one matrix R of size 100 x 100 only. I want to do it without loops. Best Answer R = sum(M,3); Related SolutionsMATLAB: Sum I am a little confused, do you mean like this:Y = reshape(1:18,6,3) % A manageable dimension.Y_1 = sum(Y,2)So in your case it would beY_1 = sum(Y,2).';..Or do you mean, more like this:Y = 1:18Y_1 = sum(reshape(Y,3,6))So in your case it would beY_1 = sum(reshape(Y,320,467)) MATLAB: Functios in MatLab for matrixes x = rand(100); n0 = sum(x(:) == 0);n0to1 = sum(x(:) > 0 & x(:) <= 1);ngt1 = sum(x(:) > 1); Related QuestionThe sum of positive elements of a matrixManaging two variables in sum functionObtain SUM for a 3D matrix
Best Answer