function [xpct] = pctile(x,pct)
 nx = size(x,2);
 pct=ceil(pct*size(x,1));
 np = max(size(pct,1),size(pct,2));
 xpct = NaN(np,nx);
 for i = 1:nx;
     tmp = sort(x(:,i));
     xpct(:,i) = tmp(pct);
 end;
end