<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'>Dear Keith,<div><br></div><div>What ft_rejectartifact does when rejecting trials completely is check the cfg.trl matrix (which contains the first, last, and offset sample with respect to the original data) for occurences of the artifact that you want to reject. If an artifact is present, it removes the line from this matrix. Then the artifact free data is read-in from disk or from memory. </div><div><br></div><div>Basically line 491 checks whether cfg.trl is empty as that would indicate that no trials are left after rejection. Am I correct in assuming you are running ft_rejectartifact on each trial separately? If so, you could also run it on the entire dataset before going through your loop with the option cfg.artfctdef.feedback = 'yes'; .Doing this will remove the trials containing jump artifacts while preserving the other trials and it will give you feedback on which trials were removed. </div><div><br></div><div>Best,</div><div><br></div><div>Jim</div><div><br><hr id="zwchr"><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;"><b>Van: </b>"Keith McConnell" <Keith.McConnell@cchmc.org><br><b>Aan: </b>fieldtrip@science.ru.nl<br><b>Verzonden: </b>Woensdag 2 oktober 2013 18:46:17<br><b>Onderwerp: </b>[FieldTrip] ft_rejectartifact<br><br>
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hello,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I have an experiment for which I have an extended stimulus for a very few number of trials (20). I would like to build a for loop to create TF plots for each trial individually.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">There are jump artifacts in the data.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">When a trial is rejected due to jump artifact my loop crashes:</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Error using ft_rejectartifact (line 491)</p>
<p class="MsoNormal">No trials left after artifact rejection.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I would like to create an if/then statement that will identify that the individual trial was rejected and return to running the for loop.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I cannot find the flag that is generated that tells me that there are no trials left.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Can someone help?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Keith</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Keith McConnell, M.S.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">513.636.0739 (desk)</p>
<p class="MsoNormal">513.504.9907 (cell)</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Division of Pulmonary Medicine</p>
<p class="MsoNormal">Cincinnati Children's Hospital Medical Center</p>
<p class="MsoNormal">Cincinnati, OH 45229</p>
<p class="MsoNormal"> </p>
</div>
<br>_______________________________________________<br>fieldtrip mailing list<br>fieldtrip@donders.ru.nl<br>http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</blockquote><br><br><br>-- <br><div><span name="x"></span>Jim Herring, MSc.<br>Neuronal Oscillations Group<br>Centre for Cognitive Neuroimaging<br>Donders Institute for Brain, Cognition and Behaviour<br>Radboud University Nijmegen<br><span name="x"></span><br></div></div></div></body></html>