function d= matpctile(x,p) % MATPCTILE - Generates a row vector of the p-th perctile values in % each column of array x. % d = matpctile(x,p) % % For ABS data where x(range,time), passing it (x',1) will return % the profiles corresponding to the 1%-ile values for all time at each % range. % % Chris Sherwood, USGS % June 3, 2004 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use of this program is self described. % Program written in Matlab v7.1.0 SP3 % Program ran on PC with Windows XP Professional OS. % % "Although this program has been used by the USGS, no warranty, % expressed or implied, is made by the USGS or the United States % Government as to the accuracy and functioning of the program % and related program material nor shall the fact of distribution % constitute any such warranty, and no responsibility is assumed % by the USGS in connection therewith." %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [nr,nc] = size(x); z = sort(x); % ascending, by columns zmin = z(:,1); zmax = z(:,nc); index = 100*cumsum(ones(nr,1))/nr; d = interp1(index,z,p);