MATLAB equivalent to rank R of function ()?

R have the following function: rank()

https://www.rdocumentation.org/packages/base/versions/3.4.1/topics/rank

This function performs the calculation and returns the order of each item in the ascending list.

(This is NOT a function order()that returns the index that each item in the list will have.)

Is there such a function in MATLAB? I suspect writing my own such function in MATLAB would be rather inefficient.

+4
source share
1 answer

Yes you can use unique():

[~, ~, rank] = unique(A); % A is the array you want to rank

Remember that the MATLAB function unique()will establish a connection differently than the R function rank().


, rank(), tiedrank(), :

rank = tiedrank(A);
+4

Source: https://habr.com/ru/post/1688239/


All Articles