If you do not expect there to be duplicates, I too recommend to use sort instead.
[~, rnkR1List] = sort(X, 2, 'descend');
If you absolutely need identical values to have the same ranks, then you could extend your own code by just inverting the ranks:
[temp, ranked] = ismember(X(i,:),unique(X(i,:)));
max(rnkR1List, , 2) - rnkR1List + 1;