[FieldTrip] Problem with EGI file

Claudio Georgii Claudio.Georgii at stud.sbg.ac.at
Mon May 30 10:53:22 CEST 2016


Hey,

i guess a more convenient & less error prone way to import the trialinfo
would be to specify your own trialfun.
Within you trialfun, just search for the stimulus value (trigger value) and
add it to a 4th column of your trl structure:

% Search for trials:
stimulus_value  = {event(find(strcmp('Stimulus', {event.type}))).value}';

% add to 4th colum of trl
trl(:,4) = str2double(stimulus_value);

After using ft_preprocessing, the 4th colum will be automatically added to
the trialinfo.

Best,
Claudio


2016-05-30 9:48 GMT+02:00 Blume Christine <christine.blume at sbg.ac.at>:

> Dear Arti,
>
> You could try to adapt the following code:
>
> % --------------------------------
> % Load & preprocess continuous files
> % ---------------------------------
>     cfg = [];
>     cfg.dataset = tmpfilename;
>     cfg.continuous='yes';
>     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!
>
> Best,
> Christine
>
> <http://www.sleepscience.at/>
> ------------------------------
> *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,
> Arti
>
>
> 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.headerfile=hdr;
> 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
> 'struct'.
>
> 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');
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>



-- 
Claudio Georgii, MSc.
Phd student
University of Salzburg - Department of Psychology
Eating Behavior Laboratory
Hellbrunnerstraße 34
5020 Salzburg - Austria

Phone: 0043- (0)662 8044 5164
E-Mail: claudio.georgii at sbg.ac.at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160530/8944ec41/attachment-0002.html>


More information about the fieldtrip mailing list