<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Leonie,<div><br></div><div><blockquote type="cite"><div dir="ltr"><p class=""><span style="font-family: Courier; ">> ERROR:</span></p><p class=""><span style="font-family: Courier; ">> Subscript indices must either be real positive integers or logicals.</span></p><p class=""><span style="font-family: Courier; ">> </span></p><p class=""><span style="font-family: Courier; ">> Error in ft_fetch_data (line 123)</span></p><p class=""><span style="font-family: Courier; ">> count = count(begsample:endsample);</span></p><p class=""><span style="font-family: Courier; ">></span></p></div></blockquote></div><div><br></div><div>The error message indicates that either begsample or endsample are badly behaved. I put my money on begsample, in that its value <= 0 in the case of a bandpassfilter-order of 9. My guess is that ft_fetch_data tries to get some data that is not there. Did you check the cfg.artfctdef.muscle.fltpadding? In general, when supplying data in the input to ft_artifact_muscle, the value of this parameter should be set to 0.</div><div><br></div><div>Best,</div><div><br></div><div>Jan-Mathijs</div><div><br></div><div><br></div><div><div><div>On Feb 25, 2013, at 9:23 PM, Pascasie L. Dombert wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><p class="" style="text-autospace:none"><span style="font-family:Courier">Hi all,</span></p><div style=""><span style="font-family:Courier"> </span><br class="webkit-block-placeholder"></div><p class="" style="text-autospace:none"><span style="font-family:Courier">I am a fieldtrip starter working on an EEG data
set. I have a question conce</span><span style="font-family:Courier">rning the </span><span style="font-family:Courier">muscle artifact detection function and I
was hoping that you could help me with this. </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">I am calling the function </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">[cfg,artifact_muscle] =
ft_artifact_muscle(cfg,ref_data) as explained in the manual (settings
suggested) and get the following error message (see code + error):</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">________________________________________________________________________________________________</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> %detect the MUSCLE artifacts</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> cfg =
[];</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> cfg.continuous =
'yes';</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> % define trial first</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> cfg.dataset =
'xx’;</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> cfg.trialfun ='trialfun_general';</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> cfg.trialdef.triallength =1;
% creates 1-second data segments </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> cfg.trialdef.ntrials <span style=""> </span><span style=""> </span><span style=""> </span>=
inf; </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span>% i.e. the complete
file</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> cfg
= ft_definetrial(cfg);</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> % cutoff</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
cfg.artfctdef.muscle.channel = 'all';</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
cfg.artfctdef.muscle.cutoff = 4;</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> % algorithmic parameters</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
cfg.artfctdef.muscle.bpfilter =
'yes';</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
cfg.artfctdef.muscle.bpfreq
= [110 140];</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
cfg.artfctdef.muscle.bpfiltord = 9;</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
cfg.artfctdef.muscle.bpfilttype = 'but';</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> cfg.artfctdef.muscle.hilbert
= 'yes';</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
cfg.artfctdef.muscle.boxcar
= 0.2;</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> % feedback</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
%cfg.artfctdef.muscle.interactive = 'yes'; % to adjust cutoff
zvalue if needed</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> [cfg, artifact_muscle] =
ft_artifact_muscle(cfg,ref_data);</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> ERROR:</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> Subscript indices must either be real
positive integers or logicals.</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> Error in ft_fetch_data (line 123)</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
count = count(begsample:endsample);</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> Error in ft_artifact_zvalue (line 195)</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
dat{trlop} = ft_fetch_data(data,
'header', hdr, 'begsample', trl(trlop,1)-fltpadding, 'endsample',
trl(trlop,2)+fltpadding, 'chanindx',</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
sgnind, 'checkboundary', strcmp(cfg.continuous,'</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> Error in ft_artifact_muscle (line 156)</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">> [tmpcfg,
artifact] = ft_artifact_zvalue(tmpcfg, data);</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">>
_______________________________________________________</span></p><div style=""><span style="font-family:Courier"> </span><br class="webkit-block-placeholder"></div><div style=""><span style="font-family:Courier"> </span><br class="webkit-block-placeholder"></div><p class="" style="text-autospace:none"><span style="font-family:Courier">However, I only get the error message with the
default/suggested values. </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">When I use:</span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">cfg.artfctdef.muscle.bpfreq = [110 120]; and
cfg.artfctdef.muscle.bpfiltord = 7; </span></p><p class="" style="text-autospace:none"><span style="font-family:Courier">I don't get the error message and the script runs
properly. Does anyone happen to know what could have let to this problem?</span></p><div style=""><span style="font-family:Courier"> </span><br class="webkit-block-placeholder"></div><p class="" style="text-autospace:none"><span style="font-family:Courier">Thanks a lot in advance!</span></p><p class=""><span style="font-family:Courier">Best, Leonie</span></p>
</div>
_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Jan-Mathijs Schoffelen, MD PhD </div><div><br></div><div>Donders Institute for Brain, Cognition and Behaviour, <br>Centre for Cognitive Neuroimaging,<br>Radboud University Nijmegen, The Netherlands</div><div><br></div><div>Max Planck Institute for Psycholinguistics,</div><div>Nijmegen, The Netherlands</div><div><br></div><div><a href="mailto:J.Schoffelen@donders.ru.nl">J.Schoffelen@donders.ru.nl</a></div><div>Telephone: +31-24-3614793</div></div></span></div></span></div></span></div></span></div></span></span>
</div>
<br></div></body></html>