Convert numeric 2D array to array of orders of values
Mostrar comentarios más antiguos
I have an array of numbers, like this:
positions =
14 25 65 20 16 15 17 16
14 26 46 0 12 0 14 5
0 0 46 13 11 11 11 17
14 25 49 11 15 17 10 11
0 0 19 15 16 20 11 13
18 4 48 20 12 12 12 24
How can I create a similar-sized array with the numbers changed to their order in each column, ie
orders =
1 2 6 4 5 3 6 4
1 3 2 NaN 2 NaN 5 1
NaN NaN 2 2 1 1 2 5
1 2 5 1 4 4 1 2
NaN NaN 1 3 5 5 2 3
4 1 4 4 2 2 4 6
This needs to cope with values that are equal, giving them both the same place and then skipping a place for the next value.
(The orders array above was created by hand, so might have errors.)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!