<div dir="ltr"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Dear
fieldtrippers,</span>

<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-family:"Arial","sans-serif"" lang="EN-US"> </span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-family:"Arial","sans-serif"" lang="EN-US">I
would like to evaluate a reaction time experiment.</span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Hence
for me two types of trigger are of interest: the onset of the stimulus and the reaction
to it.</span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-family:"Arial","sans-serif"" lang="EN-US">I
found this function at the fieldtrip homepage:</span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:blue" lang="EN-US">function</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"> [trl, event] =
mytestfunction(cfg);</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>    </span></span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>    </span>hdr =
ft_read_header(cfg.dataset);</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>    </span>event =
ft_read_event(cfg.dataset);</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>    </span></span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>    </span>value = [event(find(strcmp(</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'trigger'</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">,
{event.type}))).value]';</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>    </span>sample = [event(find(strcmp(</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'trigger'</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">,
{event.type}))).sample]';</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>      </span></span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>    </span>pretrig =
-round(cfg.trialdef.pre * hdr.Fs);</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>    </span>posttrig =
round(cfg.trialdef.post * hdr.Fs);</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>  </span></span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>   </span>trl = [];</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>   </span></span><span style="font-size:10pt;font-family:"Courier New";color:blue" lang="EN-US">for</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"> j = 1:(length(value)-1)</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>       </span>trl1 = value(j);</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>       </span>trl2 = value(j+1);</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>          </span></span><span style="font-size:10pt;font-family:"Courier New";color:blue" lang="EN-US">if</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"> trl1==3 && trl2==5</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>              </span>trlbegin =sample(j)
+ pretrig;</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>              </span>trlend = sample(j) +
posttrig;</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>              </span>offset =pretrig;</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>              </span>newtrl = [trlbegin
trlend offset];</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>              </span>trl = [trl; newtrl];</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style>          </span></span><span style="font-size:10pt;font-family:"Courier New";color:blue">end</span><span style="font-size:12pt;font-family:"Courier New""></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black"><span style>  
</span></span><span style="font-size:10pt;font-family:"Courier New";color:blue">end</span><span style="font-size:12pt;font-family:"Courier New""></span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-family:"Courier New"" lang="EN-US"> </span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Creating
the sample-matrix I get a long string (all values in one field without
delimiter). I think it’s because my values are in string format (‘DI11’, ‘DIN1’,
…). Does anyone have an idea, for example how to convert the string values to numbers
in this case? Or an other advise for a solution of this problem. </span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-family:"Arial","sans-serif"" lang="EN-US"> </span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Looking
forward to support!</span></p>

<span style="font-size:11pt;line-height:115%;font-family:"Arial","sans-serif"" lang="EN-US">Daria</span><br></div>