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

조회 수: 3 (최근 30일)
aboltabol
aboltabol 2019년 2월 11일
댓글: aboltabol 2019년 2월 11일
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.

채택된 답변

Stephen23
Stephen23 2019년 2월 11일
편집: Stephen23 2019년 2월 11일
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)

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by