| Statistics Toolbox™ | ![]() |
Y = prctile(X,p)
Y = prctile(X,p,dim)
Y = prctile(X,p) returns percentiles of the values in X. p is a scalar or a vector of percent values. When X is a vector, Y is the same size as p and Y(i) contains the p(i)th percentile. When X is a matrix, the ith row of Y contains the p(i)th percentiles of each column of X. For N-dimensional arrays, prctile operates along the first nonsingleton dimension of X.
Y = prctile(X,p,dim) calculates percentiles along dimension dim. The dim'th dimension of Y has length length(p).
Percentiles are specified using percentages, from 0 to 100. For an n-element vector X, prctile computes percentiles as follows:
The sorted values in X are taken to be the 100(0.5/n), 100(1.5/n), ..., 100([n-0.5]/n) percentiles.
Linear interpolation is used to compute percentiles for percent values between 100(0.5/n) and 100([n-0.5]/n).
The minimum or maximum values in X are assigned to percentiles for percent values outside that range.
prctile treats NaNs as missing values and removes them.
x = (1:5)'*(1:5) x = 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20 5 10 15 20 25 y = prctile(x,[25 50 75]) y = 1.7500 3.5000 5.2500 7.0000 8.7500 3.0000 6.0000 9.0000 12.0000 15.0000 4.2500 8.5000 12.7500 17.0000 21.2500
![]() | posterior (NaiveBayes) | predict (CompactTreeBagger) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |