how to find closest values in array)
Mostrar comentarios más antiguos
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 comentarios
Stephen23
el 17 de Jun. de 2017
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
el 17 de Jun. de 2017
Alex L
el 17 de Jun. de 2017
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?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Shifting and Sorting Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!