source: trunk/src/time2xmlburst.m @ 1154

Last change on this file since 1154 was 1149, checked in by sommeria, 6 months ago

extract_rdvision improved by automatic production of the xml file from timestamps

File size: 1.1 KB
Line 
1function BurstTiming=time2xmlburst(timestamps,BurstSize)
2
3if BurstSize==1 % simple series
4    BurstTiming.Dti=(timestamps(end)-timestamps(1))/(numel(timestamps)-1);
5    BurstTiming.NbDti=(numel(timestamps)-1);
6else
7    timestamps=reshape(timestamps,BurstSize,[]);
8    DtBurst=diff(timestamps,1,1);
9    dtj=round(1000*mean(DtBurst,2));% dt in integer number rounded to ms
10    Dtmin=min(dtj);
11    Dtmax=max(dtj);
12    if Dtmax==Dtmin
13        BurstTiming.Dtj=Dtmin/1000;% simple series
14        BurstTiming.NbDtj=size(timestamps,1)-1;
15    else
16        BurstTiming.Dtj=dtj/1000;%burst mode
17        BurstTiming.NbDtj=1;
18    end
19    DtSeries=diff(timestamps,1,2);
20    dti=mean(DtSeries,1);% dt in integer number rounded to ms
21    Dtmin=round(1000*mean(dti(1:2:end)));
22    Dtmax=round(1000*mean(dti(2:2:end)));
23    if Dtmax==Dtmin
24        BurstTiming.Dti=Dtmin/1000;% simple burst series
25        BurstTiming.NbDti=size(timestamps,2)-1;
26    else
27        BurstTiming.Dti=Dtmin/1000;%burst mode
28        BurstTiming.NbDti=1;
29        BurstTiming.Dtk=(Dtmin+Dtmax)/1000;%burst mode
30        BurstTiming.NbDtk=size(timestamps,2)/2-1;
31    end
32end
33
Note: See TracBrowser for help on using the repository browser.