annotate _FullBNT/KPMtools/sumv.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function T2 = sumv(T1, sum_over)
matthiasm@8 2 %
matthiasm@8 3 % Like the built in sum, but will sum over several dimensions and then squeeze the result.
matthiasm@8 4
matthiasm@8 5 T2 = T1;
matthiasm@8 6 for i=1:length(sum_over)
matthiasm@8 7 if sum_over(i) <= ndims(T2) % prevent summing over non-existent dimensions
matthiasm@8 8 T2=sum(T2, sum_over(i));
matthiasm@8 9 end
matthiasm@8 10 end
matthiasm@8 11 T2 = squeeze(T2);