Problem 1134. Get ranks of values in a vector

For a given vector, say [6 3 8 2], return the ranks (ascending) of observations, i.e. [3 2 4 1]. Do not worry about tied ranks. If ties exist, what comes first takes the lower rank, e.g., [1 1 3] returns [1 2 3]. More exact treatment of ties will follow. No toolbox functions please!

Solution Stats

59.15% Correct | 40.85% Incorrect
Last solution submitted on Sep 06, 2016

Problem Comments


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more