Array, grouping elements, adding their corresponding values and sorting from left to right
Mostrar comentarios más antiguos
Greetings
Im struggling with this problem. So I have an array :
X_Y=[4 7 6 9 7 10; 0.08 0.02 0.24 0.06 0.48 0.12]
and I need to group same value elements from first row and add their correspondig values from the second row. In this situation since there are two 7( 0.02+0.48). And lastly I need to sort the elements of first row in ascending order while maintaining their values from the second row.
The final array should look like this
X_Y=[4 6 7 9 10; 0.08 0.24 0.5 0.06 0.12]
How can I do this?
Thank you.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Shifting and Sorting Matrices 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!