How to use the prctile (X,p,'all') function?

3 views (last 30 days)
I have a matrix X of size m,n. I need to find out the 97.5 percentile and 2.5 percentile of ALL (not column wise) the values in the matrix. I am using the command
prctile(X,[97.5],'all')
as directed in https://in.mathworks.com/help/stats/prctile.html#mw_35ce46ee-d9b3-4bb7-8a69-d5a1ac746429 . However I am getting the followig the error message:
Error using :
For colon operator with char operands, first and last operands must be char.
Error in prctile (line 69)
perm = [dim:max(nDimsX,dim) 1:dim-1];
My Matlab version is R2018a and I have the Statistics Toolbox
Please help
PS. I looked into the prctile function in Matlab to resolve the error and found that this function does not process the 'all' string anywhere inside the function. I might be wrong.

Accepted Answer

Stephen23
Stephen23 on 11 Feb 2019
Edited: Stephen23 on 11 Feb 2019
According to the MATLAB documentation the 'all' option was added in version R2018b:
If you are using an earlier version then obviously you cannot use that feature (while the online help is useful and interesting it refers to the current release, so to know what your installed version does you need to look at your installed help).
Note that you can do this:
prctile(X(:),97.5)

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!