how to find closest values in array)
이전 댓글 표시
I want to find closest numbers in array as shown in example a=[4 7 8 9 10 11 20 23 26 27 28 29 30 60] output first group 7 8 9 10 11 second group 26 27 28 29 30
댓글 수: 3
Stephen23
2017년 6월 17일
How do you define groups membership? (i.e. what are the distinguishing features of values that belong to the same group?) Do you know how many groups there are in the array, or do you need to automatically detect how many groups there are? How many dimensions does the array have?
mona
2017년 6월 17일
Alex L
2017년 6월 17일
Is your array always going to be sorted? To refine your question: You are looking for groups of integers in your array that have an absolute difference of 1 to either the preceding or the following integer in the array?
채택된 답변
추가 답변 (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!