Function Reference
— Function File: a = prctile (x, p)
— Function File: a = prctile (x, p, dim)

Computes the value associated with the p-th percentile of x. If x is a matrix, computes p for each column of x. If p is a vector, the returned value is a matrix with one row for each element of p and one column for each column of x. If x is a vector, then y is a vector with the same size as p. If the argument dim is given, operate along this dimesnion rather than the columns of the matrix.

The first and last values are pegged at 0 percent and 100 percent respectively, and the rest of the values are uniformly spaced between them, with linear interpolation between the points. This is consistent with the definition of quantile given in the R statistics package, but inconsistent with that of the statistics toolbox from Matlab.