[FieldTrip] Updating trial information

Carolina Ogawa carolyogawa at gmail.com
Wed Jul 17 17:22:46 CEST 2019


Dear community,

My name is Carolina Ogawa, and I'm working with EEG at the University of
Sao Paulo, Brazil. I intend to analyze oscillatory gamma activity from the
EEG data I recorded.

I'd like to know how I get the trial information (the information stored in
"cfg.event" and "cfg.trl") updated after rejecting segments of data (due to
artifacts), so that my data will be correctly segmented into trials
afterwards.

My pipeline involves, in the following order:

   1. Rereferencing and filtering (ft_preprocesing)

   (cfg definition)
   ...
   data_filt      = ft_preprocessing(cfg);

   2. Defining trials with ft_definetrial (so that I have the trials
   information stored on "cfgout.trl")

       cfg                            = [];
       cfg.dataset                 = fullfile(path_inputData,subject{i});
       cfg.trialdef.eventtype = 'Stimulus';
       cfg.trialfun                   = 'ft_trialfun_general';
       cfgout                         = ft_definetrial(cfg);

   3. Removing segments with artifacts, using ft_databrowser and
   ft_rejectartifact. (EEG data is continuous up to this point).

       cfg               = [];
       cfg.continuous    = 'yes';
       cfg.channel       = 'all';
       cfg.viewmode      = 'butterfly';
       artif             = ft_databrowser(cfg, data_filt);

       cfg                        = [];
       cfg.artfctdef.minaccepttim = 0.010;
       cfg.artfctdef.reject       = 'partial';
       cfg.artfctdef.visual.artifact = artif.artfctdef.visual.artifact;
       data_rejInt = ft_rejectartifact(cfg, data_filt);



I tried using "ft_recodeevent", as follows:

cfg = [];
trl = cfgout.trl;
cfg.trl = trl;
cfg.eventtype = 'Stimulus';
[ev] = ft_recodeevent(cfg, data_rejInt);

but I get this error:

Error using ft_recodeevent (line 114) could not locate event structure in
the data


Can someone tell me if there something wrong with the "cfg" settings of if
I'm using an improper function to this situation? I also tried running
"ft_rejectartifact" with "cfg" as the only input parameter, expecting that
the output would be a "cfg" structure with an updated "trl" (as described
in the "ft_rejectartifact" reference page). Instead, what I receive is the
error:

Undefined function or variable "trl".
Error in ft_rejectartifact (line 252) if isempty(trl)


Any help would be appreciated,

Best,
Carolina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190717/8ab4a6e0/attachment-0001.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list