[FieldTrip] Problem with EGI file

Blume Christine christine.blume at sbg.ac.at
Mon May 30 09:48:12 CEST 2016

Dear Arti,

You could try to adapt the following code:

% --------------------------------
% Load & preprocess continuous files
% ---------------------------------
    cfg = [];
    cfg.dataset = tmpfilename;
    cfg.hpfilter = 'yes';
    cfg.hpfilttype = 'but';
    cfg.hpfreq  = 0.5; % Hz
    cfg.channel = elecs_183_selec;
    data_cont = ft_preprocessing(cfg);

    % -----------------------------------------
    % define trials
    cfg = [];
    cfg.dataset = tmpfilename; % datafile to read events from
    cfg.eventformat = 'egi_mff_v2';
    cfg.trialdef.prestim = 2; % in seconds
    cfg.trialdef.poststim = 2; % in seconds

    cfg.trialdef.eventtype  = {'DIN12'};
    cfgDIN12 = ft_definetrial(cfg);

    tmp_data_segm12 = ft_redefinetrial(cfgDIN12, data_cont); %Segmentation

The problem is that for me, it does not import the trialinfo. Therefore, I do the segmentation (here for DIN12) separately for all triggers, then append all tmp_data_segm and write the following code for adding the trialinfo:

    data_segm.trialinfo=[ones(1, length(tmp_data_segm12.trial))*12]

Hope that helps!


Von: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl]" im Auftrag von "Arti Abhishek [mailtome.2113 at gmail.com]
Gesendet: Montag, 30. Mai 2016 05:38
An: FieldTrip discussion list
Betreff: [FieldTrip] Problem with EGI file

Dear fieldtrip community,

I am trying to analyse eeg recorded from EGI. I want to highpass filter the data before epoching and I managed to create the following script from the fieldtrip documentation. However I am getting an error (please see below). Could someone suggest a fix.

Thank you,

datadir = 'D:\EGITest';
dataset =  fullfile(datadir, 's01_CH.mff');
headerformat = 'egi_mff_v2';
dataformat   = 'egi_mff_v2';
eventformat  = 'egi_mff_v2';
hdr   = ft_read_header(dataset, 'headerformat', headerformat);
dat   = ft_read_data(dataset,   'headerformat', headerformat, 'dataformat', dataformat);
event = ft_read_event(dataset,  'headerformat', headerformat, 'eventformat', eventformat);
fg = [];
cfg.data = dat;
cfg.trialdef.triallength = Inf;
cfg.trialdef.ntrials = 1;
cfg = ft_definetrial(cfg);
cfg.hpfilter = 'yes';
cfg.hpfreq = .1;
cfg.hpfilttype = 'firws';
cfg.hpfiltdir = 'onepass-zerophase';
alldata = ft_preprocessing(cfg);

I am getting the following error

Undefined function 'exist' for input arguments of type

Error in isdir (line 10)
result = exist(dirpath,'dir') == 7;

Error in ft_filetype (line 150)
if isdir(filename)

Error in ft_checkconfig (line 559)
    cfg.dataformat = ft_filetype(cfg.datafile);

Error in ft_definetrial (line 128)
cfg = ft_checkconfig(cfg, 'dataset2files', 'yes');

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160530/8db0bf6c/attachment-0002.html>

More information about the fieldtrip mailing list