<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">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:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; line-height: normal;"></div><blockquote type="cite" class=""><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">clear;</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">clc;</font></div><div style="margin: 0px; line-height: normal; min-height: 12px;" class=""><font face="Menlo" class="" style="font-size: 12px;"> <br class="webkit-block-placeholder"></font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(178, 69, 243);"><font face="Menlo" class="" style="font-size: 12px;"><span class="">data_path = </span>‘/.../raw/'<span class="">;</span></font></div><div style="margin: 0px; line-height: normal; min-height: 12px;" class=""><font face="Menlo" class="" style="font-size: 12px;"> <br class="webkit-block-placeholder"></font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;">%STEP 1: reading the data in</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg = [];</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.dataset = [data_path <font color="#b245f3" class="">’subj1.vhdr'</font>];</font></div><div style="margin: 0px; line-height: normal; min-height: 12px;" class=""><font face="Menlo" class="" style="font-size: 12px;"> <br class="webkit-block-placeholder"></font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;">%high-pass filter</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.preproc.hpfilter = <span class="" style="color: rgb(178, 69, 243);">'yes'</span>;</font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;"><span class="">cfg.preproc.hpfiltord = 2; </span>%known bug for filtering; can be avoided by changing the order of the filter (2 is random)</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.preproc.hpfreq = 0.1; <span class="" style="color: rgb(37, 153, 45);">%in Hz</span></font></div><div style="margin: 0px; line-height: normal; color: rgb(37, 153, 45); min-height: 12px;" class=""><font face="Menlo" class="" style="font-size: 12px;"> <br class="webkit-block-placeholder"></font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;">%rereference</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.preproc.reref = <span class="" style="color: rgb(178, 69, 243);">'yes'</span>;</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.preproc.channel = <span class="" style="color: rgb(178, 69, 243);">'all'</span>;</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.preproc.implicitref = <span class="" style="color: rgb(178, 69, 243);">''</span>; <span class="" style="color: rgb(37, 153, 45);">%on-line reference is empty</span></font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;"><span class="">cfg.preproc.refchannel = {</span><span class="" style="color: rgb(178, 69, 243);">'M1'</span><span class="">, </span><span class="" style="color: rgb(178, 69, 243);">'M2'</span><span class="">}; </span>%the channels we want to rereference our data against. In this </font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;"><span class=""> </span>%case, we will rereference against the linked mastoids</font></div><div style="margin: 0px; line-height: normal; color: rgb(37, 153, 45); min-height: 12px;" class=""><font face="Menlo" class="" style="font-size: 12px;"> <br class="webkit-block-placeholder"></font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;">%updating channel locations; %% MPI/DCCN versions of actiCAP?</font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(178, 69, 243);"><font face="Menlo" class="" style="font-size: 12px;"><span class="">cfg.layout = </span>'/Users/.../MATLAB/fieldtrip-master/template/layout/acticap-64ch-standard2.mat'<span class="">; </span><span class="" style="color: rgb(37, 153, 45);">%the file we want to extract electrode coordinates from</span></font></div><div style="margin: 0px; line-height: normal; color: rgb(37, 153, 45); min-height: 12px;" class=""><font face="Menlo" class="" style="font-size: 12px;"> <br class="webkit-block-placeholder"></font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;">%demean</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.deman = <span class="" style="color: rgb(178, 69, 243);">'yes'</span>;</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.basewindow = [-.2 0];</font></div><div style="margin: 0px; line-height: normal; min-height: 12px;" class=""><font face="Menlo" class="" style="font-size: 12px;"><br class=""></font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;">%STEP 2: defining trials and epoching</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.trialdef.prestim = 0.2;</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.trialdef.poststim = 1; <span class="" style="color: rgb(37, 153, 45);">% epochs will be -200 1000 ms </span></font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.trialdef.eventtype = <span class="" style="color: rgb(178, 69, 243);">'Stimulus'</span>;</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">cfg.trialfun = <span class="" style="color: rgb(178, 69, 243);">'trialfun_congruency</span><font color="#b245f3" class="">’</font>; <font color="#77bb41" class="">%customized function for the data</font></font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;"><span class=""><font color="#25992d" class="">data_in = </font><font color="#3a88fe" class="">ft_definetrial(cfg);</font><font color="#25992d" class=""> </font></span><font color="#25992d" class="">%this will create a trl structure field, which is a list</font></font></div><div class="" style="margin: 0px; line-height: normal; color: rgb(37, 153, 45);"><font face="Menlo" class="" style="font-size: 12px;">% of 3 columns, where every row describes a separate trial start, end and offset</font></div><div class="" style="margin: 0px; line-height: normal;"><font face="Menlo" class="" style="font-size: 12px;">data_prej = ft_preprocessing(cfg);</font></div></blockquote><p class="" style="margin: 0px; font-size: 10px; line-height: normal; min-height: 12px;"> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; line-height: normal; color: rgb(37, 153, 45); min-height: 12px;" class=""><br class=""></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;">This is the error that pops up:</div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"></div><blockquote type="cite" class=""><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="font-size: 12px;"><font face="Menlo" class="">Error using ft_preprocessing (line 387)</font></span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="font-size: 12px;"><font face="Menlo" class="">you must call FT_DEFINETRIAL prior to FT_PREPROCESSING</font></span></div></blockquote></div><div class=""><br class=""></div><div class="">which is weird, since <span class="" style="font-family: Menlo;">ft_definetrial()</span><span class="" style="font-family: Menlo; color: rgb(37, 153, 45);"> </span>is called right <i class="">before </i><span class="" style="font-family: Menlo;">ft_preprocessing()</span>. Does anyone know what the problem could be? </div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">-Roberto</div><div class=""><br class=""></div><div class="">——</div><div class="">Roberto Petrosino<div class="">PhD student in Linguistics</div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">CT Institute from Brain and Cognitive Sciences</span></div><div class="">University of Connecticut</div></div></div>
<br class=""></body></html>