matrix sorting and distibution
Afficher commentaires plus anciens
I have this matrix:
2 2 82 10 16 15 66 76 71 83 44 49
4 2 91 28 98 43 4 75 4 70 39 45
4 1 13 55 96 92 85 40 28 32 77 65
1 2 92 96 49 80 94 66 5 96 80 71
1 2 64 97 81 96 68 18 10 4 19 76
the code should look to first column,if its not repeated,gives the output:
8 1 6 7 5 10 9 3 4 2 which is the indices after sorting in descending way.
if its repeated,look to the second column if 1 ,the code should sort the elements of second line and distribute them as 1:7 to original and the rest to the repetition
if the of second column is 2 ,the code should divide 1:5 to first and 5:10 to the second.
the result should look like:
8 1 6 7 5 10 9 3 4 2
3 1 6 8 10 0 0 0 0 0
4 9 2 5 7 0 0 0 0 0
2 8 5 1 4 0 0 0 0 0
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!