MATLAB: Separating elements in Length vectors

vector

Suppose I have the following data set:
Length =
1.02219692622952
8.29383522727246
17.3975329545455
26.5394026041666
37.4131448863634
48.709668181819
51.4079249999999
61.0677
67.3565390625
76.1625590909094
85.4651375000007
94.6553875000006
105.547397159091
116.990150000001
119.621383914209
129.406797916667
133.8319
141.022715625
150.280673295453
159.456462499999
170.332771874999
181.707094886364
184.246947727274
193.971341666667
204.952635795454
214.060199999998
223.163925000002
233.997125000002
245.374622960725
247.969915909091
197.672519594595
257.617404411765
260.998768555373
268.448049999999
277.622496875
286.750634374999
297.561936363639
308.926818749999
311.588342613638
321.184121875001
328.941806034484
347.096843750003
356.222274999998
367.040681250001
378.45856363637
381.169198863638
390.490676136364
337.968181250005
I want to count how many times the data runs for every
61.0677
129.406797916667
193.971341666667
257.617404411765
321.184121875001
390.490676136364
I was wondering how this can be done.

Best Answer

v=min(x):60:max(x); % x is your array
id=0;
clear out
for k=2:numel(v)
[~,idx]=min(abs(x-v(k)));
id(k)=idx;
out{k-1}=x(id(k-1)+1:id(k))
end