Displaying 1 result from an estimated 1 matches for "codeit".
Did you mean:
codeis
2011 May 21
1
Group close numbers in a vector
Hi everyone,
i am trying to group close numbers in a vector.
For example i have a vector x = [1 2 4 7 9 10 15].
I want the code to pick 1 2 4 (max difference between successive numbers is
2) and assign them to variable a, then pick 7 9 10 and assign them to b and
15 to c. But since i do not know how many groups there will be the code
should create a,b,c etc as it goes along. So if x = [1 2 4 7 9