FUNCTION REFERENCE
prctile
Percentiles of data.
Percentiles of data.
Syntax
P = prctile(X, p)Syntax
P = prctile(X, p, dim)p holds percentages from 0 to 100. Each sorted value is assigned a percentile by the midpoint rule: the k-th of n values is the 100*(k-0.5)/n percentile. Percentiles between two such points interpolate linearly; percentiles below the first or above the last point give the smallest or largest value. NaN values are ignored, and a lane with no values gives NaN. For a vector X the result has the orientation of p; for a matrix X each row of the result holds one percentile per column (dim 1, the default for matrices) or each column one percentile per row (dim 2). prctile([], p) is NaN. X is double, single or logical: single input gives single results (computed in double, then rounded), and integer input is an error, as the published page lists single and double only.
Example
prctile([6 3 2 10 1], [5 50 95]) % [1 3 10]Differences from MATLAB: Only the midpoint method; no 'Method' option, 'all' or vector dimensions. Real 2-D data only; dim 3 or higher works only for a single percentage.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.