sum - summing up rows of two or more vectors in MATLAB -
if have 2 vectors say:
element_collect(:,:,1) = 1.3689 2.7376 3.4220 3.7642 3.9353 element_collect(:,:,2) = 1.3688 2.0531 2.3953 3.7640 5.7316 now, want add rows of both vectors 1 one new results.
e.g: if add 1st rows of both vectors, should result this:
z(:,:,1) = 1.3689 + 1.3688 (=2.7377) similarly, if add 2nd rows of both vectors, should result as:
z(:,:,2) = 2.7376 + 2.0531 (=4.7907) and other rows.
i tried using following code dont desired results:
z = sum(element_collect)
can me getting results want!
thanks
you need example -
z = sum(element_collect(:,:,1:2),3) if add 3, 4 , 5 in third dimension, -
z = sum(element_collect(:,:,1:5),3) if add in third dimension, -
z = sum(element_collect(:,:,:),3)
Comments
Post a Comment