Hello,
I have an array of data points, which looks like this when sorted into ascending order.
x = [ 18 23 30 54 54 98];
There are gaps between consecutive entries there are possibly duplicates.
I would like to relabel the entries like this
x = [ 1 2 3 4 4 5];
A possibility would be a for loop with an increment, but is there a better way?
Thanks very much!

 채택된 답변

Birdman
Birdman 2018년 3월 16일

0 개 추천

[~,~,idx]=unique(x)

추가 답변 (0개)

카테고리

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

제품

태그

질문:

2018년 3월 16일

댓글:

2018년 3월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by