[Eeglablist] Import larger ANT continuous file

Min Bao ustcbm at yahoo.com.cn
Mon Apr 18 12:41:51 PDT 2011


Dear Arno,
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:
firstReadDur = 1800; %in sec
[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;
EEG = pop_loadeep([datapath,thename] , 'sample1', 0, 'sample2', firstReadDur*srate, 'triggerfile', 'on'); %1800 means 30 minutes.
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 0, 'setname', 'first 30 min'); eeglab redraw;
tfilename = dir('*.trg');
fid = fopen(tfilename(1).name,'r');
nheadlines = 2;
for k = 1:nheadlines
    fgetl(fid);
end
alltrg = fscanf(fid,'%e');
alltrg = reshape(alltrg,[3 numel(alltrg)/3])';
fclose(fid);
 
lastreadtime = firstReadDur; % 1800 sec
skipline = find(alltrg(:,1)>lastreadtime);
skipline = skipline(1)-1;
skipline = skipline+nheadlines;

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.
ALLEEG = pop_delset( ALLEEG, [1] );
EEG = bm_loadeep([datapath,thename] ,skipline, 'sample1', firstReadDur*srate+1, 'sample2', foo.totsamples, 'triggerfile', 'on');
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 0, 'setname', 'segment 2');
eeglab redraw;
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.
Cheers,
Min
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20110419/34ab1547/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bm_loadeep.m
Type: application/octet-stream
Size: 5774 bytes
Desc: not available
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20110419/34ab1547/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bm_importevent.m
Type: application/octet-stream
Size: 14776 bytes
Desc: not available
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20110419/34ab1547/attachment-0001.obj>


More information about the eeglablist mailing list