Dear all,
<div><br></div><div>I have one problem concerning ft_rejectartifact function. </div><div>I did everything as you explained in automatic artifact rejection tutorial. I mark segments first and that is fine, but the ft_rejectartifact doesn't remove marked bad segments form my data. </div>
<div>Please help!</div><div><br></div><div>Here is my code:</div><div><br></div><div><div>% automatic</div><div>clear all</div><div><br></div><div>s=[87 209 195 225 60];</div><div><br></div><div><br></div><div>for g=1:length(s)</div>
<div>    input_no=s(g)</div><div>    </div><div>    clear sub</div><div>    </div><div>    sub=['Subject' num2str(input_no)];</div><div>    eval(sub)   %calling subject's script</div><div>         </div><div>            </div>
<div>            cfg=[];</div><div>            cfg.trialdef.eventtype  = 'UPPT001';</div><div>            cfg.trialdef.eventvalue = 1;</div><div>            cfg.trialdef.prestim    = 0.1;</div><div>            cfg.trialdef.poststim   = 0.5;</div>
<div>            cfg.trialfun = 'trialfun_general';</div><div>            cfg.channel<span class="Apple-tab-span" style="white-space:pre">          </span>= {'MEG'};</div><div>            cfg.continuous = 'yes';</div>
<div>            cfg.dataset = [subjectdata.wr11.datadir];</div><div>            </div><div>            [data1]=ft_definetrial(cfg)</div><div>            trial=data1.trl;</div><div>            </div><div>                        </div>
<div>            % muscle</div><div>            cfg=[];</div><div>            cfg.trl =trial;</div><div>            cfg.datafile   = [subjectdata.wr11.datafile];</div><div>            cfg.headerfile =[subjectdata.wr11.headerfile];</div>
<div>            cfg.continuous = 'yes';</div><div>            </div><div>            % channel selection, cutoff and padding</div><div>            cfg.artfctdef.zvalue.channel = 'MRT*';</div><div>            cfg.artfctdef.zvalue.cutoff      = 15;</div>
<div>            cfg.artfctdef.zvalue.trlpadding  = 0.5;</div><div>            cfg.artfctdef.zvalue.fltpadding  = 0.5;</div><div>            cfg.artfctdef.zvalue.artpadding  = 0.1;</div><div>            </div><div>            % algorithmic parameters</div>
<div>            cfg.artfctdef.zvalue.bpfilter    = 'yes';</div><div>            cfg.artfctdef.zvalue.bpfreq      = [110 140];</div><div>            cfg.artfctdef.zvalue.bpfiltord   = 9;</div><div>            cfg.artfctdef.zvalue.bpfilttype  = 'but';</div>
<div>            cfg.artfctdef.zvalue.hilbert     = 'yes';</div><div>            cfg.artfctdef.zvalue.boxcar      = 0.2;</div><div>            </div><div>            %make the process interactive</div><div>            cfg.artfctdef.zvalue.interactive = 'yes';</div>
<div>            </div><div>            [cfg, artifact_muscle] = ft_artifact_zvalue(cfg)</div><div>            </div><div><br></div><div><br></div><div>            % jump</div><div>            cfg=[];</div><div>            cfg.trl =  trial;</div>
<div>            cfg.datafile   = [subjectdata.wr11.datafile];</div><div>            cfg.headerfile =[subjectdata.wr11.headerfile];</div><div>            cfg.continuous = 'yes';</div><div>            </div><div>            % channel selection, cutoff and padding</div>
<div>            cfg.artfctdef.zvalue.channel    = 'MEG';</div><div>            cfg.artfctdef.zvalue.cutoff     = 20;</div><div>            cfg.artfctdef.zvalue.trlpadding = 0;</div><div>            cfg.artfctdef.zvalue.artpadding = 0;</div>
<div>            cfg.artfctdef.zvalue.fltpadding = 0;</div><div>            </div><div>            % algorithmic parameters</div><div>            cfg.artfctdef.zvalue.cumulative    = 'yes';</div><div>            cfg.artfctdef.zvalue.medianfilter  = 'yes';</div>
<div>            cfg.artfctdef.zvalue.medianfiltord = 9;</div><div>            cfg.artfctdef.zvalue.absdiff       = 'yes';</div><div>            </div><div>            % make the process interactive</div><div>            cfg.artfctdef.zvalue.interactive = 'yes';</div>
<div>            </div><div>            [cfg, artifact_jump] = ft_artifact_zvalue(cfg)</div><div>            </div><div>            </div><div><br></div><div><br></div><div>            cfg.artfctdef.reject = 'complete'; </div>
<div>            cfg.artfctdef.jump.artifact = artifact_jump;</div><div>            cfg.artfctdef.muscle.artifact = artifact_muscle;</div><div>            data_no_artifacts = ft_rejectartifact(data1)</div><div> end</div><div>
<br></div><div>Thank you in advance!</div><div>NP</div><div>            </div></div><div><br></div>