I have a 189 x 4914 matrix and am trying to find the sum of each row in each 1x26 sub-matrix. How would I go about this?
Many thanks.
Try this:
n = 26; result = reshape(sum(reshape(x.', n, []), 1), [], size(x, 1)).';
You can look at intermediate results to see how this works: reshape(x.', n, []), then sum(reshape(x.', n, []), 1) etc
reshape(x.', n, [])
sum(reshape(x.', n, []), 1)
Try this:
You can look at intermediate results to see how this works:
reshape(x.', n, [])
, thensum(reshape(x.', n, []), 1)
etc