<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Dear Arno,<div><br></div><div>Thanks for the reply! Right now I have my own script to deal with this problem. The trick is to use loadeep to read a small number of samples from the beginning of the raw data to obtain some basic information of the data, such as sampling rate and the number of total samples. Then read only a part of the entire data (e.g. 30 minutes for a data recorded at a sampling rate of 512Hz) and find the corresponding line marking the events in the trigger file. For example:</div><div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">firstReadDur = 1800; <span style="color: #228b22">%in sec</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">EEG = pop_loadeep([datapath,thename] , <span style="color: #a020f0">'sample1'</span>, 0, <span style="color: #a020f0">'sample2'</span>, firstReadDur*srate, <span style="color: #a020f0">'triggerfile'</span>, <span style="color: #a020f0">'on'</span>); <span style="color: #228b22">%1800 means 30 minutes.</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 0, <span style="color: #a020f0">'setname'</span>, <span style="color: #a020f0">'first 30 min'</span>); </p></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">eeglab <span style="color: #a020f0">redraw</span>;</p></div><div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">tfilename = dir(<span style="color: #a020f0">'*.trg'</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">fid = fopen(tfilename(1).name,<span style="color: #a020f0">'r'</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">nheadlines = 2;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier"><span style="color: #0000ff">for</span> k = 1:nheadlines</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">    fgetl(fid);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier; color: #0000ff">end</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">alltrg = fscanf(fid,<span style="color: #a020f0">'%e'</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">alltrg = reshape(alltrg,[3 numel(alltrg)/3])';</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">fclose(fid);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier; min-height: 17.0px"> </p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">lastreadtime = firstReadDur; <span style="color: #228b22">% 1800 sec</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">skipline = find(alltrg(:,1)>lastreadtime);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">skipline = skipline(1)-1;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">skipline = skipline+nheadlines;</p></div><div><br></div><div><br></div><div>Next, read the remaining data and remaining lines in the trigger file. The bm_loadeep function was slightly modified from loadeep, which was attached together with another function bm_importevent on this email.</div><div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">ALLEEG = pop_delset( ALLEEG, [1] );</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">EEG = bm_loadeep([datapath,thename] ,skipline, <span style="color: #a020f0">'sample1'</span>, firstReadDur*srate+1, <span style="color: #a020f0">'sample2'</span>, foo.totsamples, <span style="color: #a020f0">'triggerfile'</span>, <span style="color: #a020f0">'on'</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 0, <span style="color: #a020f0">'setname'</span>, <span style="color: #a020f0">'segment 2'</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier">eeglab <span style="color: #a020f0">redraw</span>;</p></div><div><br></div><div>These will serve data shorter than 1 hour. For larger datasets, one need to use a loop to repeat these steps. But still hope the more official plugin comes out.</div><div><br></div><div>Cheers,</div><div><br></div><div>Min</div></td></tr></table>