LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
trace_iat2bins.m
1function [C,bC]=trace_iat2bins(S,scale)
2% computes the counts C of S in each bin with timescale "scale"
3% binC(i) gives the bin of membership element i
4n = length(S);
5CS = cumsum(S);
6bins = ceil((CS(end)-CS(1))/scale);
7C = zeros(1,bins);
8bC=[];
9cur = 1;
10last = 0;
11for i=1:(bins+1)
12 if cur == n
13 break;
14 end
15 while CS(cur+1) <= i*scale
16 cur = cur + 1;
17 if cur == n
18 break;
19 end
20 end
21 C(i) = cur - last;
22 bC(end+1:end+(cur - last)) = i;
23 last = cur;
24end
25end