Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How to use the index of a matrix using Unique function to alter a second matrix?
조회 수: 1 (최근 30일)
이전 댓글 표시
Say I am looking at 1 row of two matrices
A = [ 2 5 9 3 5 ]
B = [ 1 13 2 8 7]
Using the unique function on A, how would i use the index to rearrange B to match A. Example A1 = B1 , A2 = B2, ...
If i use
[value, indx] = unique(A);
I should get an output of [2 3 5 9] ... how do I apply the index to make B = [ 1, 8, 13, 2] (keeping the matrix values matching)
댓글 수: 0
답변 (1개)
KALYAN ACHARJYA
2019년 10월 1일
편집: KALYAN ACHARJYA
2019년 10월 1일
how do I apply the index to make B = [ 1, 8, 13, 2]
>> B=B(indx)
B =
1 8 13 2
Code:
A = [ 2 5 9 3 5 ];
B = [ 1 13 2 8 7];
[value, indx]= unique(A);
B=B(indx)
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!