y=nt_normcol(x) - normalize each row so its msq is 1 y: normalized data x: data to normalize
0001 function x=nt_normrow(x) 0002 % y=nt_normcol(x) - normalize each row so its msq is 1 0003 % 0004 % y: normalized data 0005 % 0006 % x: data to normalize 0007 % 0008 0009 if ndims(x)>2 0010 s=size(x); 0011 x=nt_normrow(reshape(x,[x,prod(s(2:end))])); 0012 x=reshape(x,s); 0013 else 0014 w=1./sqrt(mean(x.^2,2)); 0015 w(find(isnan(w)))=0; 0016 x=bsxfun(@times,x,w); 0017 end 0018 0019