How to link two arrays?
이전 댓글 표시
Dear all,
I have two arrays:
A = [1,2,3,4,5,6,7,8,9,10];
B = [11,12,13,14,15,16,17,18,19,20];
If A became New_A = [4,3,2,1,10,9,8,7,6,5];
Then how to apply the same change to B such that
New_B = [14,13,12,11,20,19,18,17,16,15].
Any help will be appreciated.
Meshoo
채택된 답변
추가 답변 (1개)
Jan
2017년 1월 30일
If A contains the sorted numbers from 1 to n as in your example, the solution is easy:
B_new = B(A_new);
But maybe this matters the example data for the forum only.
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!