<div dir="ltr">Dear Joseph, thanks so much, I really appreciate your help. I was also wandering, if maybe there is another bug in my code.<div>Our nets are 128 channels, Hydrocel, but as a colleague of me adviced me to do so, I also tried the 129 layout. </div><div>My code you find below (without selection of bad channels etc.) </div><div>If you need also the data of two subjects to have a look, let me know!!!</div><div>Best and thanks really!</div><div> Katrin</div><div><br></div><div>
<p class=""><br></p>
<p class=""><span class="">subject=input(</span>'Which subject do you want to analyse? '<span class="">,</span>'s'<span class="">);</span></p>
<p class="">name = strcat(subject,<span class="">'.raw'</span>);</p>
<p class=""><span class="">subjectnumber=input(</span>'Which is the subjectnumber?'<span class="">, </span>'s'<span class="">);</span></p>
<p class="">sb=subjectnumber</p>
<p class="">%subjectnumber = strcat(subjectnumber, <span class="">'.txt'</span>)</p>
<p class="">%%</p>
<p class=""><br></p>
<p class="">cfg = [];</p>
<p class="">cfg.dataset = name;</p>
<p class="">cfg.trialfun = <span class="">'ft_trialfun_general'</span>; % this is the <span class="">default</span></p>
<p class="">cfg.trialdef.eventtype = <span class="">'trigger'</span>;</p>
<p class="">cfg.trialdef.eventvalue = <span class="">'stim'</span>; % the value of the stimulus trigger </p>
<p class="">cfg.trialdef.prestim = <span class="">0.234</span>; % <span class="">in</span> seconds</p>
<p class="">cfg.trialdef.poststim = <span class="">7.266</span>; % <span class="">in</span> seconds (whole time of video observation, but maybe we need less)</p>
<p class="">cfg = ft_definetrial(cfg);</p>
<p class=""><br></p>
<p class="">cfg.trl([<span class="">1</span>:<span class="">7</span>],:) = []; </p>
<p class=""><br></p>
<p class="">%change timeline according to constant offset of <span class="">16</span> ms = <span class="">8</span> samples (because recorded with <span class="">500</span> hz)<span class="">in</span></p>
<p class="">%structure trial</p>
<p class="">cfg.trl(:,<span class="">3</span>)=cfg.trl(:,<span class="">3</span>)-<span class="">8</span></p>
<p class=""><br></p>
<p class="">%change timeline to make the cut the zeropoint</p>
<p class=""><br></p>
<p class="">cfg.trl(:,<span class="">3</span>)=cfg.trl(:,<span class="">3</span>)- <span class="">1000</span>;</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% preprocess data</p>
<p class="">cfg.channel = <span class="">'all'</span>;</p>
<p class="">cfg.preproc.detrend = <span class="">'yes'</span>;</p>
<p class="">cfg.preproc.demean = <span class="">'yes'</span>;</p>
<p class="">cfg.preproc.baselinewindow = [-<span class="">2.1</span> -<span class="">2.0</span>]</p>
<p class="">%cfg.preproc.bpfilter = <span class="">'yes'</span>; - the data here has to be already filtered</p>
<p class="">%(<span class="">0.1</span>-<span class="">45</span>) and bad channels have to be replaced!!!!</p>
<p class="">%cfg.preproc.bpfreq = [<span class="">6</span> <span class="">32</span>];</p>
<p class="">% </p>
<p class="">% </p>
<p class="">obs_data = ft_preprocessing(cfg);</p>
<p class="">% </p>
<p class="">save (strcat(sb,<span class="">'obs_data'</span>) , <span class="">'obs_data'</span>)</p>
<p class=""><br></p>
<p class="">%% determining channel neighbours (necessary <span class="">for</span> Artifact detection)</p>
<p class="">cfg = [];</p>
<p class="">cfg.channel = obs_data.label;</p>
<p class="">cfg.layout = <span class="">'GSN128.sfp'</span>;</p>
<p class="">cfg.feedback = <span class="">'yes'</span>;</p>
<p class="">lay = ft_prepare_layout(cfg);</p>
<p class=""> </p>
<p class="">cfg_neighb = [];</p>
<p class="">cfg_neighb.feedback = <span class="">'yes'</span>;</p>
<p class=""><br></p>
<p class="">cfg_neighb.method = <span class="">'triangulation'</span>;</p>
<p class="">cfg_neighb.layout = <span class="">'GSN128.sfp'</span>;</p>
<p class="">neighbours = ft_prepare_neighbours(cfg_neighb, obs_data);</p>
<p class=""><br></p>
<p class="">obs_data.elec = ft_read_sens(<span class="">'GSN128.sfp'</span>);</p>
<p class=""><br></p>
<p class="">%% Artifacts - to detect bad channels - is not saved!!!</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">cfg.method = <span class="">'summary'</span>;</p>
<p class="">cfg.latency=[<span class="">0</span> <span class="">1</span>];</p>
<p class="">cfg.layout = <span class="">'GSN128.sfp'</span>; % this allows <span class="">for</span> plotting</p>
<p class="">obs_data_try = ft_rejectvisual(cfg, obs_data); </p>
<p class=""><br></p>
<p class="">cfg = [];</p>
<p class="">cfg.viewmode = <span class="">'vertical'</span>;</p>
<p class="">cfg.latency=[<span class="">0</span> <span class="">1</span>];</p>
<p class="">cfg.continuous = <span class="">'no'</span>;</p>
<p class="">cfg.plotlabels=<span class="">'yes'</span></p>
<p class="">cfg = ft_databrowser(cfg,obs_data);</p>
<p class="">%cfg.artfctdef.reject = <span class="">'complete'</span>; </p>
<p class="">obs_data_try = ft_rejectartifact (cfg,obs_data);</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% Preparing neighbours <span class="">for</span> channel repair - but bad channel info <span class="">in</span>!!!</p>
<p class=""><br></p>
<p class="">% cfg_neighb = [];</p>
<p class="">% cfg_neighb.feedback = <span class="">'yes'</span>;</p>
<p class="">% cfg_neighb.method = <span class="">'triangulation'</span>;</p>
<p class="">% cfg_neighb.layout = <span class="">'GSN-HydroCel-128.sfp'</span>;</p>
<p class="">% neighbours = ft_prepare_neighbours(cfg_neighb, obs_data);</p>
<p class=""><br></p>
<p class="">% Interpolate and put into new data structure</p>
<p class=""> cfg = []; </p>
<p class=""> cfg.badchannel = {};</p>
<p class=""> cfg.layout = <span class="">'GSN128.sfp'</span>;</p>
<p class=""> cfg.method = <span class="">'nearest'</span>;</p>
<p class=""> cfg.neighbours = neighbours;</p>
<p class=""> obs_data_channelrepaired = ft_channelrepair(cfg,obs_data)</p>
<p class=""><br></p>
<p class=""> % Check reconstruction</p>
<p class="">cfg = [];</p>
<p class="">cfg.viewmode = <span class="">'vertical'</span>;</p>
<p class="">cfg.continuous = <span class="">'no'</span>;</p>
<p class="">cfg.plotlabels=<span class="">'yes'</span></p>
<p class="">cfg = ft_databrowser(cfg,obs_data_channelrepaired);</p>
<p class="">%cfg.artfctdef.reject = <span class="">'complete'</span>; </p>
<p class="">obs_data_clean1 = ft_rejectartifact (cfg,obs_data_channelrepaired);</p>
<p class=""><br></p>
<p class="">% dat1=obs_data;</p>
<p class="">% dat2=obs_data_channelrepaired;</p>
<p class="">% </p>
<p class="">% x=dat1.trial{<span class="">1</span>}(<span class="">62</span>,:); % <span class="">68</span> is channel index of E68</p>
<p class="">% y=dat2.trial{<span class="">1</span>}(<span class="">62</span>,:);</p>
<p class="">% plot(x);hold on;plot(y,<span class="">'r'</span>);</p>
<p class="">% </p>
<p class="">% x=dat1.trial{<span class="">1</span>}(<span class="">72</span>,:);</p>
<p class="">% y=dat2.trial{<span class="">1</span>}(<span class="">75</span>,:);</p>
<p class="">% figure;</p>
<p class="">% plot(x);hold on;plot(y,<span class="">'r'</span>)</p>
<p class="">% </p>
<p class="">% x=dat1.trial{<span class="">1</span>}(<span class="">75</span>,:);</p>
<p class="">% y=dat2.trial{<span class="">1</span>}(<span class="">75</span>,:);</p>
<p class="">% figure;</p>
<p class="">% plot(x);hold on;plot(y,<span class="">'r'</span>)</p>
<p class="">%% artifact rejection/trial inspection - throw <span class="">out</span> electrode jumps etc.</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">cfg = [];</p>
<p class="">cfg.viewmode = <span class="">'vertical'</span>;</p>
<p class="">cfg.continuous = <span class="">'no'</span>;</p>
<p class="">cfg.plotlabels=<span class="">'yes'</span></p>
<p class="">cfg = ft_databrowser(cfg,obs_data_channelrepaired);</p>
<p class="">%cfg.artfctdef.reject = <span class="">'complete'</span>; </p>
<p class="">obs_data_clean1 = ft_rejectartifact (cfg,obs_data_channelrepaired);</p>
<p class=""><br></p>
<p class="">%% ICA - Anzahl der Komponenten anpassen!- adapt numcomponent according to channels interpolated %% <span class="">128</span>-number of interp. channels)</p>
<p class=""> </p>
<p class="">cfg = [];</p>
<p class="">cfg.channel = {<span class="">'all'</span>};</p>
<p class="">cfg.numcomponent = <span class="">128</span></p>
<p class="">comp = ft_componentanalysis(cfg,obs_data_clean1);</p>
<p class="">save (strcat(sb,<span class="">'comp_all'</span>) , <span class="">'comp'</span>)</p>
<p class=""><br></p>
<p class="">%% </p>
<p class="">cfg = [];</p>
<p class="">cfg.viewmode = <span class="">'component'</span>; </p>
<p class="">cfg.continuous = <span class="">'no'</span>; </p>
<p class="">cfg.plotlabels=<span class="">'some'</span>;</p>
<p class="">cfg.layout = <span class="">'GSN128.sfp'</span>;</p>
<p class="">ft_databrowser(cfg,comp);</p>
<p class=""><br></p>
<p class="">%% poweranalysis components</p>
<p class="">cfg = [];</p>
<p class="">cfg.output = <span class="">'pow'</span>;</p>
<p class="">cfg.channel = <span class="">'all'</span>;%compute the power spectrum <span class="">in</span> all ICs</p>
<p class="">cfg.method = <span class="">'mtmfft'</span>;</p>
<p class="">cfg.taper = <span class="">'hanning'</span>;</p>
<p class="">cfg.foi = <span class="">0</span>:<span class="">0.2</span>:<span class="">50</span>;</p>
<p class="">obs_freq = ft_freqanalysis(cfg, comp);</p>
<p class=""><br></p>
<p class="">%And you can plot the spectra:</p>
<p class=""><br></p>
<p class="">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</p>
<p class="">nsubplots = <span class="">16</span>;</p>
<p class="">nbyn = sqrt(nsubplots);% sqrt(nsubplots) should not contain decimals, type doc subplot</p>
<p class=""><br></p>
<p class="">Nfigs = ceil(size(comp.topo,<span class="">1</span>)/nsubplots);</p>
<p class="">tot = Nfigs*nsubplots;</p>
<p class=""><br></p>
<p class="">rptvect = <span class="">1</span>:size(comp.topo,<span class="">1</span>);</p>
<p class="">rptvect = padarray(rptvect, [<span class="">0</span> tot-size(comp.topo,<span class="">1</span>)], <span class="">0</span>,<span class="">'post'</span>);</p>
<p class="">rptvect = reshape(rptvect,nsubplots,Nfigs)<span class="">';</span></p>
<p class=""><br></p>
<p class=""><span class="">for</span> r=<span class="">1</span>:size(rptvect,<span class="">1</span>);</p>
<p class=""> figure;set(gcf,<span class="">'units'</span>,<span class="">'normalized'</span>,<span class="">'outerposition'</span>,[<span class="">0</span> <span class="">0</span> <span class="">1</span> <span class="">1</span>]);%full screen</p>
<p class=""> k=<span class="">0</span>;</p>
<p class=""> <span class="">for</span> j=<span class="">1</span>:size(rptvect,<span class="">2</span>);</p>
<p class=""> <span class="">if</span>~(rptvect(r,j)==<span class="">0</span>);</p>
<p class=""> k=k+<span class="">1</span>;</p>
<p class=""> cfg=[];</p>
<p class=""> cfg.channel = rptvect(r,j);</p>
<p class=""> cfg.ylim =[<span class="">0</span> <span class="">500</span>]</p>
<p class=""> cfg.xlim =[<span class="">0</span> <span class="">50</span>]</p>
<p class=""> subplot(nbyn,nbyn,k);ft_singleplotER(cfg,obs_freq);</p>
<p class=""> end</p>
<p class=""> end</p>
<p class="">end</p>
<p class=""><br></p>
<p class=""><span class="">%For the IC topos you</span>'ll follow the same logic as above but with:</p>
<p class=""><br></p>
<p class="">figure</p>
<p class="">cfg = [];</p>
<p class="">cfg.component = [<span class="">1</span>:<span class="">20</span>]; % specify the component(s) that should be plotted</p>
<p class="">cfg.layout = <span class="">'GSN128.sfp'</span>; </p>
<p class="">cfg.comment = <span class="">'no'</span>;</p>
<p class="">ft_topoplotIC(cfg, comp)</p>
<p class=""><br></p>
<p class="">figure</p>
<p class="">cfg = [];</p>
<p class="">cfg.component = [<span class="">21</span>:<span class="">40</span>]; % specify the component(s) that should be plotted</p>
<p class="">cfg.layout = <span class="">'GSN128.sfp'</span>; </p>
<p class="">cfg.comment = <span class="">'no'</span>;</p>
<p class="">ft_topoplotIC(cfg, comp)</p>
<p class=""><br></p>
<p class="">figure</p>
<p class="">cfg = [];</p>
<p class="">cfg.component = [<span class="">41</span>:<span class="">60</span>]; % specify the component(s) that should be plotted</p>
<p class="">cfg.layout = <span class="">'GSN128.sfp'</span>; </p>
<p class="">cfg.comment = <span class="">'no'</span>;</p>
<p class="">ft_topoplotIC(cfg, comp)</p>
<p class=""><br></p>
<p class="">figure</p>
<p class="">cfg = [];</p>
<p class="">cfg.component = [<span class="">61</span>:<span class="">80</span>]; % specify the component(s) that should be plotted</p>
<p class="">cfg.layout = <span class="">'GSN128.sfp'</span>; </p>
<p class="">cfg.comment = <span class="">'no'</span>;</p>
<p class="">ft_topoplotIC(cfg, comp)</p>
<p class=""><br></p>
<p class=""><br></p>
<p class=""><br></p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% Seperate observation conditions</p>
<p class=""><br></p>
<p class="">name1= strcat(num2str(sb),<span class="">'_90.xls'</span>);</p>
<p class=""> list1=xlsread (name1)</p>
<p class=""> </p>
<p class=""> </p>
<p class="">name2= strcat(num2str(sb),<span class="">'_180.xls'</span>);</p>
<p class=""> list2=xlsread (name2)</p>
<p class=""> </p>
<p class="">% </p>
<p class=""><br></p>
<p class="">cfg = []</p>
<p class="">cfg.trials = [list1]</p>
<p class="">obs90_data = ft_redefinetrial(cfg,obs_data_channelrepaired)</p>
<p class=""><br></p>
<p class="">cfg = []</p>
<p class="">cfg.trials = [list2]</p>
<p class="">obs180_data = ft_redefinetrial(cfg,obs_data_channelrepaired)</p>
<p class=""><br></p>
<p class="">%%PIPELINE FOR obs90</p>
<p class=""><br></p>
<p class="">%% Decompose original data according to the components found before</p>
<p class="">load (strcat(sb,<span class="">'comp_all'</span>))</p>
<p class=""><br></p>
<p class="">cfg = [];</p>
<p class="">cfg.numcomponent = <span class="">128</span>;</p>
<p class="">cfg.unmixing = comp.unmixing;</p>
<p class="">cfg.topolabel = comp.topolabel;</p>
<p class=""><br></p>
<p class="">comp_1 = ft_componentanalysis(cfg, obs90_data);</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% Reject component</p>
<p class="">cfg = [];</p>
<p class=""> cfg.component = [];</p>
<p class=""> obs90_data_ica_cleaned = ft_rejectcomponent(cfg, comp_1, obs90_data);</p>
<p class=""> </p>
<p class=""><br></p>
<p class=""><span class=""> save (strcat(sb,</span>'obs90_ica_cleaned'<span class="">) , </span>'obs90_data_ica_cleaned'<span class="">)</span></p>
<p class=""><br></p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% Artifacts - final detection</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">cfg.method = <span class="">'summary'</span>;</p>
<p class="">cfg.latency=[<span class="">0</span> <span class="">1</span>];</p>
<p class="">cfg.layout = <span class="">'GSN128.sfp'</span>; % this allows <span class="">for</span> plotting</p>
<p class="">obs90_data_clean3 = ft_rejectvisual(cfg, obs90_data_ica_cleaned); </p>
<p class=""><br></p>
<p class="">cfg = [];</p>
<p class="">cfg.viewmode = <span class="">'vertical'</span>;</p>
<p class="">cfg.latency=[<span class="">0</span> <span class="">1</span>];</p>
<p class="">cfg.continuous = <span class="">'no'</span>;</p>
<p class="">cfg.plotlabels=<span class="">'yes'</span></p>
<p class="">cfg = ft_databrowser(cfg,obs90_data_clean3);</p>
<p class="">%cfg.artfctdef.reject = <span class="">'complete'</span>; </p>
<p class="">obs90_data_clean2 = ft_rejectartifact (cfg,obs90_data_clean3);</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">% Save clean data</p>
<p class=""><br></p>
<p class=""><span class="">save (strcat(subject,</span>'obs90_clean'<span class="">) , </span>'obs90_data_clean2'<span class="">)</span></p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% Rereferencing data</p>
<p class="">cfg = [];</p>
<p class=""><br></p>
<p class="">cfg.channel = <span class="">'all'</span>;</p>
<p class="">cfg.preproc.reref = <span class="">'yes'</span>;</p>
<p class="">cfg.preproc.refchannel = <span class="">'all'</span>; </p>
<p class="">obs90_data_ref= ft_preprocessing(cfg,obs90_data_clean2)</p>
<p class=""><br></p>
<p class=""><span class="">save (strcat(subject,</span>'obs90_ref'<span class="">) , </span>'obs90_data_ref'<span class="">)</span></p>
<p class="">%% Snap <span class="">out</span> smaller pieces (the third second)</p>
<p class=""><br></p>
<p class="">cfg = []</p>
<p class="">cfg.toilim = [<span class="">0</span> <span class="">1</span>]</p>
<p class=""><br></p>
<p class="">obs90_data_small = ft_redefinetrial(cfg,obs90_data_ref)</p>
<p class=""><br></p>
<p class="">%% TIMELOCK ERP</p>
<p class="">obs90_data_ERP = ft_timelockanalysis(cfg, obs90_data_small);</p>
<p class=""><br></p>
<p class=""><span class="">save (strcat(subject,</span>'obs90_ERP'<span class="">) , </span>'obs90_data_ERP'<span class="">)</span></p>
<p class=""><br></p>
<p class="">%% plot it</p>
<p class="">cfg = [];</p>
<p class="">cfg.layout = lay ;</p>
<p class="">cfg.interactive = <span class="">'yes'</span>;</p>
<p class="">ft_multiplotER(cfg, obs90_data_ERP)</p>
<p class=""><br></p>
<p class=""><br></p>
<p class=""><br></p>
<p class=""><br></p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% PIPELINE FOR obs180</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% Decompose original data according to the components found before</p>
<p class="">load (strcat(sb,<span class="">'comp_all'</span>))</p>
<p class=""><br></p>
<p class="">cfg = [];</p>
<p class="">cfg.numcomponent = <span class="">128</span></p>
<p class="">cfg.unmixing = comp.unmixing;</p>
<p class="">cfg.topolabel = comp.topolabel;</p>
<p class="">comp_2 = ft_componentanalysis(cfg, obs180_data);</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% Reject component</p>
<p class="">cfg = [];</p>
<p class=""> cfg.component = [];</p>
<p class=""> obs180_data_ica_cleaned = ft_rejectcomponent(cfg, comp_2, obs180_data);</p>
<p class=""> </p>
<p class=""><br></p>
<p class=""><span class=""> save (strcat(sb,</span>'obs180_ica_cleaned'<span class="">) , </span>'obs180_data_ica_cleaned'<span class="">)</span></p>
<p class=""><br></p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% Artifacts final <span class="">180</span></p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">cfg.method = <span class="">'summary'</span>;</p>
<p class="">cfg.latency=[<span class="">0</span> <span class="">1</span>];</p>
<p class="">cfg.layout = <span class="">'GSN128.sfp'</span>; % this allows <span class="">for</span> plotting</p>
<p class="">obs180_data_clean3 = ft_rejectvisual(cfg, obs180_data_ica_cleaned); </p>
<p class=""><br></p>
<p class="">cfg = [];</p>
<p class="">cfg.viewmode = <span class="">'vertical'</span>;</p>
<p class="">cfg.latency=[<span class="">0</span> <span class="">1</span>];</p>
<p class="">cfg.continuous = <span class="">'no'</span>;</p>
<p class="">cfg.plotlabels=<span class="">'yes'</span></p>
<p class="">cfg = ft_databrowser(cfg,obs180_data_clean3);</p>
<p class="">%cfg.artfctdef.reject = <span class="">'complete'</span>; </p>
<p class="">obs180_data_clean2 = ft_rejectartifact (cfg,obs180_data_clean3);</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">% Save clean data</p>
<p class=""><br></p>
<p class=""><span class="">save (strcat(subject,</span>'obs180_clean'<span class="">) , </span>'obs180_data_clean2'<span class="">)</span></p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">%% Rereferencing data</p>
<p class="">cfg = [];</p>
<p class="">cfg.channel = <span class="">'all'</span>;</p>
<p class="">cfg.preproc.reref = <span class="">'yes'</span>;</p>
<p class="">cfg.preproc.refchannel = <span class="">'all'</span>; </p>
<p class="">obs180_data_ref= ft_preprocessing(cfg,obs180_data_clean2)</p>
<p class=""><br></p>
<p class=""><span class="">save (strcat(subject,</span>'obs180_ref'<span class="">) , </span>'obs180_data_ref'<span class="">)</span></p>
<p class="">%% Snap <span class="">out</span> smaller pieces (the third second)</p>
<p class=""><br></p>
<p class="">cfg = []</p>
<p class="">cfg.toilim = [<span class="">0</span> <span class="">1</span>]</p>
<p class=""><br></p>
<p class="">obs180_data_small = ft_redefinetrial(cfg,obs180_data_ref)</p>
<p class=""><br></p>
<p class="">%% TIMELOCK ERP</p>
<p class="">obs180_data_ERP = ft_timelockanalysis(cfg, obs180_data_small);</p>
<p class=""><br></p>
<p class=""><span class="">save (strcat(subject,</span>'obs180_ERP'<span class="">) , </span>'obs180_data_ERP'<span class="">)</span></p>
<p class=""><br></p>
<p class="">%% plot <span class="">180</span> ERP</p>
<p class=""><br></p>
<p class="">cfg = [];</p>
<p class="">cfg.layout = lay ;</p>
<p class="">cfg.interactive = <span class="">'yes'</span>;</p>
<p class="">ft_multiplotER(cfg, obs180_data_ERP)</p>
<p class=""><br></p>
<p class="">%% plot both ERPs</p>
<p class=""><br></p>
<p class="">cfg = [];</p>
<p class="">cfg.layout = lay ;</p>
<p class="">cfg.interactive = <span class="">'yes'</span>;</p>
<p class="">cfg.showlabels = <span class="">'yes'</span>;</p>
<p class="">ft_multiplotER(cfg, obs90_data_ERP, obs180_data_ERP)</p>
<p class=""><br></p>
<p class="">%% plot difference wave</p>
<p class=""><br></p>
<p class="">difference = obs180_data_ERP; % copy one of the structures</p>
<p class="">difference.avg = obs180_data_ERP.avg - obs90_data_ERP.avg; % compute the difference ERP</p>
<p class=""> </p>
<p class="">cfg = [];</p>
<p class="">cfg.layout = lay;</p>
<p class="">cfg.interactive = <span class="">'yes'</span>;</p>
<p class="">ft_multiplotER(cfg, difference)</p></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-09-07 7:53 GMT+02:00 Joseph Dien <span dir="ltr"><<a href="mailto:jdien07@mac.com" target="_blank">jdien07@mac.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hi,</div><div> I’m one of the main Fieldtrip contributors working on supporting EGI data. A couple things. First of all, exactly which net do you use? If they are 129-channel, there is still the question of whether they are the Hydrocel or the older geodesic nets. Regardless, that shouldn't cause an error like this. Could you send me the file you are trying to process and the script you are using and I’ll try troubleshooting it.</div><div><br></div><div>Joe</div><div><div class="h5"><div><br></div><br><div><div>On Aug 26, 2014, at 12:53 AM, Ana Laura Diez Martini <<a href="mailto:diezmartini@gmail.com" target="_blank">diezmartini@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">Which nets do you use? I use EGI. I tried both the ones you mention and they didn't work. It was hard to find that exact one online but it was the only file that actually worked.</div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Aug 25, 2014 at 7:52 AM, KatrinH Heimann <span dir="ltr"><<a href="mailto:katrinheimann@gmail.com" target="_blank">katrinheimann@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Dear Ana, dear all, <div>the layout you used does not correspond to our nets. I tried the <br>
GSN-HydroCel-128.sfp and the GSN-HydroCel-129.sfp. Both don't work. Please can anybody help?</div><div>Cheers</div><div>Katrin</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-24 5:40 GMT+02:00 Ana Laura Diez Martini <span dir="ltr"><<a href="mailto:diezmartini@gmail.com" target="_blank">diezmartini@gmail.com</a>></span>:<div>
<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Try<a href="https://www.dropbox.com/s/58zv658rtdant2c/GSN129.sfp?dl=0" target="_blank"> this one</a> I use</div>
<div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Sun, Aug 24, 2014 at 4:08 AM, KatrinH Heimann <span dir="ltr"><<a href="mailto:katrinheimann@gmail.com" target="_blank">katrinheimann@gmail.com</a>></span> wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="ltr">Dear all, my problems seem neverending. This time however i really need help. <div>
I implemented a pipeline for ERPs. All works now, trialdefinition, preprocessing, channelreplacement, ica, componentrejection, final artifactdetection, timelock of the single subject data. However, when I wanna compute the grandaverage of the single subjects I get the following error message:</div>
<div><br></div><div><div>computing average of avg over 19 subjects</div><div>Warning: discarding electrode information because it cannot be averaged </div><div>> In ft_timelockgrandaverage at 249 </div><div>the call to "ft_timelockgrandaverage" took 0 seconds and required the additional allocation of an estimated 3 MB</div>
<div>computing average of avg over 2 subjects</div><div>Warning: discarding electrode information because it cannot be averaged </div><div>> In ft_timelockgrandaverage at 249 </div><div>the call to "ft_timelockgrandaverage" took 0 seconds and required the additional allocation of an estimated 0 MB</div>
<div>the call to "ft_prepare_layout" took 0 seconds and required the additional allocation of an estimated 0 MB</div><div>the call to "ft_topoplotER" took 0 seconds and required the additional allocation of an estimated 0 MB</div>
</div><div><br></div><div>Furthermore in the plot of the significant clusters, the channelnames are mixed up (do not correspond to my net)</div><div><br></div><div><br></div><div>I guess that there is a problem with the layout I use. </div>
<div>Here the code that I use <br></div><div><br></div><div>%For generating the layout (also in the single subjects):</div><div><p>cfg = [];</p><p>cfg.channel = obs_data.label;</p><p><span>cfg.layout = </span>'GSN-HydroCel-129.sfp'<span>;</span></p><p>cfg.feedback = <span>'yes'</span>;</p><p>lay = ft_prepare_layout(cfg);</p><div> <br></div><p>cfg_neighb = [];</p><p>cfg_neighb.feedback = <span>'yes'</span>;</p><p>cfg_neighb.method = <span>'triangulation'</span>;</p><p>cfg_neighb.layout = lay;</p><p>neighbours = ft_prepare_neighbours(cfg_neighb, obs_data);</p><div> <br></div><p>obs_data.elec = ft_read_sens(<span>'GSN-HydroCel-129.sfp'</span>);</p><p><br></p><p>%For computing the grand average</p><p>cfg = [];</p><p>cfg.channel = <span>'all'</span>;</p><p>cfg.latency = <span>'all'</span>;</p><p>cfg.parameter = <span>'avg'</span>;</p><p>cfg.keepindividual = <span>'no'</span></p><p>GA_90 = ft_timelockgrandaverage(cfg,all90{:}); </p><p>GA_180 = ft_timelockgrandaverage(cfg,all180{:});</p><p>% "{:}" means to use data from all elements of the variable</p><div> <br></div><p>For plotting the significant clusters</p><p>cfg = [];</p><p>cfg.style = <span>'blank'</span>;</p><p>cfg.layout = lay;</p><p>cfg.channellabels = <span>'yes'</span>;</p><p>cfg.highlight = <span>'labels'</span>;</p><p>cfg.highlightchannel = find(stat.mask);</p><p>cfg.comment = <span>'no'</span>;</p><p>figure; ft_topoplotER(cfg, GA_90)</p><p><span>title(</span>'Nonparametric: significant with cluster multiple comparison correction'<span>)</span></p><p><span><br></span></p><p><span>Do you have ANY idea to this? I am really completely helpless....</span></p><p>thanks and best</p><p>Katrin</p></div></div>
<br></div>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote></div><br></div></div><div>
<div><font face="Calibri, Arial, Helvetica, sans-serif" size="3">--------------------------------------------------------------------------------<br><br>Joseph Dien, PhD<br></font><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:medium">Research Associate</span><font face="Calibri, Arial, Helvetica, sans-serif" size="3"><br></font><div><font face="Calibri, Arial, Helvetica, sans-serif" size="3">Cognitive Neurology</font></div><div style="font-family:Calibri,Arial,Helvetica,sans-serif">The Johns Hopkins University School of Medicine</div><div style="font-family:Calibri,Arial,Helvetica,sans-serif"><br></div><div style="font-family:Calibri,Arial,Helvetica,sans-serif"><span style="font-size:16px;background-color:rgb(255,255,255)">Lab E-mail: <a href="mailto:jdien1@jhmi.edu" target="_blank">jdien1@jhmi.edu</a></span></div><div style="font-family:Calibri,Arial,Helvetica,sans-serif"><div style="font-size:16px;background-color:rgb(255,255,255)">Private E-mail: <a href="mailto:jdien07@mac.com" target="_blank">jdien07@mac.com</a></div><div style="font-size:16px;background-color:rgb(255,255,255)">Office Phone: <a href="tel:410-614-3115" value="+14106143115" target="_blank">410-614-3115</a></div></div><div style="font-family:Calibri,Arial,Helvetica,sans-serif">Cell Phone: <a href="tel:202-297-8117" value="+12022978117" target="_blank">202-297-8117</a></div><div><font face="Calibri, Arial, Helvetica, sans-serif" size="3">Fax: <a href="tel:410-955-0188" value="+14109550188" target="_blank">410-955-0188</a><br><a href="http://joedien.com" target="_blank">http://joedien.com</a></font></div></div>
</div>
<br></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>