[FieldTrip] ft_definetrial() and ft_preprocessing()

Roberto Petrosino robpetrosino at gmail.com
Sat Mar 10 22:28:56 CET 2018


Hi all,

I am trying to preprocess my eeg raw data (from BrainVision amplifiers), but I am having troubles with error I can’t figure out how to fix. Here’s the code:

> clear;
> clc;
>  
> data_path = ‘/.../raw/';
>  
> %STEP 1: reading the data in
> cfg             =   [];
> cfg.dataset     =   [data_path ’subj1.vhdr'];
>  
> %high-pass filter
> cfg.preproc.hpfilter    =   'yes';
> cfg.preproc.hpfiltord   =   2; %known bug for filtering; can be avoided by changing the order of the filter (2 is random)
> cfg.preproc.hpfreq      =   0.1; %in Hz
>  
> %rereference
> cfg.preproc.reref       =   'yes';
> cfg.preproc.channel     =   'all';
> cfg.preproc.implicitref =   ''; %on-line reference is empty
> cfg.preproc.refchannel  =   {'M1', 'M2'}; %the channels we want to rereference our data against. In this 
>                               %case, we will rereference against the linked mastoids
>  
> %updating channel locations; %% MPI/DCCN versions of actiCAP?
> cfg.layout      =   '/Users/.../MATLAB/fieldtrip-master/template/layout/acticap-64ch-standard2.mat'; %the file we want to extract electrode coordinates from
>  
> %demean
> cfg.deman       =   'yes';
> cfg.basewindow  =   [-.2 0];
> 
> %STEP 2: defining trials and epoching
> cfg.trialdef.prestim        =   0.2;
> cfg.trialdef.poststim       =   1; % epochs will be -200 1000 ms 
> cfg.trialdef.eventtype      =   'Stimulus';
> cfg.trialfun                =   'trialfun_congruency’; %customized function for the data
> data_in                     =   ft_definetrial(cfg); %this will create a trl structure field, which is a list
> % of 3 columns, where every row describes a separate trial start, end and offset
> data_prej                   =   ft_preprocessing(cfg);
 

This is the error that pops up:
> Error using ft_preprocessing (line 387)
> you must call FT_DEFINETRIAL prior to FT_PREPROCESSING


which is weird, since ft_definetrial() is called right before ft_preprocessing(). Does anyone know what the problem could be? 

Thanks,
-Roberto

——
Roberto Petrosino
PhD student in Linguistics
CT Institute from Brain and Cognitive Sciences
University of Connecticut

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180310/45b13517/attachment-0001.html>


More information about the fieldtrip mailing list