armenfrast Posted April 12, 2010 Posted April 12, 2010 (edited) Bonjour, Hello, Je recherche un peu d'assistance sur le mode de fonctionnement de la fonction array_sort I need a little help with the function Array_sort Je souhaite trier l'array suivant i would like to sort the following array $classement[$i][2] où $i est l'index de l'enregistrement (la saisie initiale est séquentielle) where $i is the index number of the entry (the initial entry is sequential) par hypothèse $i=100 Tel que / such as $position[$i][0] = N° d'identifiant unique (Unique ID number) $position[$i][1] = Score A l'origine j'ai donc le tableau suivant Initially I have the following array |ID |Score $i [0] [1] 1 |172 |80 2 |82 |53 3 |9 |93 4 |70 |66 5 |47 |87 6 |91 |66 etc… Je voudrais disposer du tableau suivant I would like to obtain the following array (sorted by Score) |ID |Score $i [0] [1] 1 |9 |93 2 |47 |87 3 |172 |80 4 |70 |66 5 |91 |66 6 |82 |53 etc… NB: Pour l'égalité je n'ai pas de préférence pour l'ordre de classement. NB: Regarding the matches I have no preference for their sort order. Merci Edited April 12, 2010 by armenfrast
99ojo Posted April 12, 2010 Posted April 12, 2010 Hi, this example sorts on array element $array [$i] [1], highest value on 1st: #include <array.au3> Dim $array [5] [2] For $i = 0 To 4 $array [$i] [0] = Random (1, 100, 1) $array [$i] [1] = Random (1, 100, 1) Next _ArrayDisplay ($array) _ArraySort ($array, 1, 0, 0, 1) _ArrayDisplay ($array) ;-)) Stefan
armenfrast Posted April 12, 2010 Author Posted April 12, 2010 Thank you that was much more simple than what I thought. Those UDF lack a good tutorial explaining their functions and how to use them.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now