Array, grouping elements, adding their corresponding values and sorting from left to right
이전 댓글 표시
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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!