<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Patrick,<br>
<br>
What you can do is use partial artifact rejection by calling
ft_rejectarttifact with cfg.artfctdef.reject = 'partial'. Then
subsequently loop over the trials you get, and identify the ones (by
looking at data.time{iTr}) that do not start at the time your trials
normally start (this means it's a trial after an artifact). Finally,
exclude those by using ft_redefinetrials.<br>
<br>
For instance, if your trials start with t=0, then after
ft_rejectartifact you can do something like:<br>
ind_keep = zeros(length(data.trial),1); %allocate<br>
for iTrl = 1:length(data.trial)<br>
if data.trial{iTrl}(1) ~= 0 <br>
%this means it's a trial occurring AFTER an artifact<br>
ind_keep(iTrl) = false;<br>
else<br>
%this means it's a trial occurring BEFORE an artifact<br>
ind_keep(iTrl) = true;<br>
end<br>
end<br>
<br>
%only keep the trials before the artifact:<br>
cfg = [];<br>
cfg.trials = find(ind_keep);<br>
data = ft_redefinetrial(cfg, data);<br>
<br>
Hope this helps,<br>
Ingrid<br>
<br>
<div class="moz-cite-prefix">On 12/5/2012 5:57 AM, Jung, Patrick
wrote:<br>
</div>
<blockquote
cite="mid:36E953F5321EB743AC6B338995A56D632519C8@UM-EXCDAG-A01.um.gwdg.de"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@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:0cm;
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;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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"><span lang="EN-GB">Dear all, <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">in the reference
documentation it says “In case of partial artifact
rejection, a minimum length of the<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">resulting sub-trials can
be specified.”<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I’d like to reject the
trial segment from the beginning of the artifact onwards to
keep only the data before the artifact occurred.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">But I don’t want to
append subtrials.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">How can I do that in
fieldtrip?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Many thanks for your
help!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Best, <br>
Patrick<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
fieldtrip mailing list
<a class="moz-txt-link-abbreviated" href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
<a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305</pre>
</body>
</html>