Matlab - matrix addition in for loop -
i have 7x21 matrix called a. within matrix there 3 equally sized 7x7 submatrices. call them b,c , d, b = a(:,1:7), c = a(:,8:14) , d = a(:,15:21).
how can produce matrix e 7x7 matrix b, c , d added up, i.e. e = b+c+d.
thanks lot help!
generic code such output -
n = 3; %// number of submatrices [m,n] = size(a) %// size [no. of cols must multiple of n e = reshape(sum(reshape(a,m*n/n,[]),2),m,n/n)
Comments
Post a Comment