% Usage: y = kdownsample(x)
% Down sample a row vector or matrix x (column-wise) to a vector y, 
% killing all odd components (or even indexed by Matlab.
function y = kdownsample(x)

[m,n]=size(x);
if m==1
   m2 = ceil(n/2);
   y = zeros(1,m2);
   y(1:m2) = x(1:2:n);
else
   m2 = ceil(m/2);
   y=zeros(m2,1);
   y(1:m2) = x(1:2:m);
end