I have a group number of array
1) [2 3 2 1] I want [1 2 1 3]
2) [3 3 1 2] I want [1 1 2 3]

 채택된 답변

Jonas
Jonas 2022년 11월 28일

1 개 추천

i think you are searching for this:
[~,~,c]=unique([2 3 2 1],'stable')
c = 4×1
1 2 1 3
[~,~,c]=unique([3 3 1 2],'stable')
c = 4×1
1 1 2 3

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

질문:

2022년 11월 28일

답변:

2022년 11월 28일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by