calculated the rank correlation coefficient.
r = nan_rankcorr(X,Y)
This function is replaced by corrcoef. Significance test and confidence intervals can be obtained from corrcoef, too.
R = nan_corrcoef(X, [Y, ] 'Rank');
The rank correlation r = corrcoef(ranks(x)). is often confused with Spearman's rank correlation. Spearman's correlation is defined as
r(x,y) = 1-6*sum((ranks(x)-ranks(y)).^2)/(N*(N*N-1))
The results are different. Here, the former version is implemented.
[1] http://mathworld.wolfram.com/SpearmanRankCorrelationCoefficient.html
[2] http://mathworld.wolfram.com/CorrelationCoefficient.html