function dist(x,p)
% DIST  Tabulates percentile distributions of x
%
% function dist(x,p)
%
% Note - will crash if there are no data in one of the bins.

% Chris Sherwood, USGS
% March 17, 1999

n = length(x);
z = sort(x);
zmin = z(1);
zmax = z(n);
index = 100*cumsum(ones(n,1))/n;
%pct1 =  table1([index,z],1);
pct5 =  table1([index,z],5);
pct16 =  table1([index,z],16);
pct25 = table1([index,z],25);
pct50 = table1([index,z],50);
pct75 = table1([index,z],75);
pct84 = table1([index,z],84);
pct95 = table1([index,z],95);
%pct99 = table1([index,z],99);
zmean = mean(x);
zstd = std(x);
fprintf('\n   Mean    : %g\n',zmean);
fprintf('   Std Dev : %g\n\n',zstd);
fprintf('   Minimum   : %g\n',zmin);
%fprintf('    1-pctile : %g\n',pct1);
fprintf('    5-pctile : %g\n',pct5);
fprintf('   16-pctile : %g\n',pct16);
fprintf('   25-pctile : %g\n',pct25);
fprintf('   50-pctile : %g\n',pct50);
fprintf('   75-pctile : %g\n',pct75);
fprintf('   84-pctile : %g\n',pct84);
fprintf('   95-pctile : %g\n',pct95);
%fprintf('   99-pctile : %g\n',pct99);
fprintf('   Maximum   : %g\n\n',zmax);
if ( nargin == 2 ),
plot(z,index);
end






