Hi all -
I'd like to take an array and break it into sub-arrays, based on the difference between values.. It might be easier to illustrate:
I have an array:
a = [0.4, 0.42, 0.45, 0.46, 0.6, 0.7];
And I want to set a threshold of difference - in this case: 0.02.
newArray = [[0.4, 0.42], [0.45, 0.46], [0.6], [0.7]];
Is there a function that does this kind of sorting intrinsically? Can anyone suggest an approach?