annotate toolboxes/FullBNT-1.0.7/bnt/examples/static/Zoubin/rsum.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 % row sum
wolffd@0 2 % function Z=rsum(X)
wolffd@0 3
wolffd@0 4 function Z=rsum(X)
wolffd@0 5
wolffd@0 6 [N M]=size(X);
wolffd@0 7
wolffd@0 8 Z=zeros(N,1);
wolffd@0 9
wolffd@0 10 if M==1,
wolffd@0 11 Z=X;
wolffd@0 12 elseif M<2*N,
wolffd@0 13 for m=1:M,
wolffd@0 14 Z=Z+X(:,m);
wolffd@0 15 end;
wolffd@0 16 else
wolffd@0 17 for n=1:N
wolffd@0 18 Z(n)=sum(X(n,:));
wolffd@0 19 end;
wolffd@0 20 end