function yp = pad(y, n)
% make a vector a standard length, padding end with NaN

[nr, nc] = size(y);
% error handling later

yp = zeros(1,n);
if nr > n, nr = n;, end;  % clip it if necessary
yp(1:nr) = y(1:nr);
if nr < n,
   yp((nr+1):n) = NaN * ones(1,n-nr);
end

yp = yp';
