<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Dear Julia,
<div><br>
</div>
<div>it seems that we are going down the same road. I am also in the process of building a pipeline for spike-field coherence and I am orienting myself along the mentioned tutorial. </div>
<div><br>
</div>
<div>That being said, it should become clear that I am far from being an expert for this kind of analysis. Nevertheless, I want to share what I have learned about it in the last days. I hope someone else in the list will correct me in case. This post should
 also serve as a check for my own analysis.  </div>
<div><br>
</div>
<div>First, you don't have to re-do your prior analysis for your neuralynx data. You only have to bring the outputs of your analysis into a format that the ft_xxx functions can read. Y<span style="font-size: 13.3333px;">ou probably already </span><span style="font-size: 13.3333px;">have
 all the required information for that from your previous spike sorting. </span></div>
<div><br>
</div>
<div>Let's look at the data structure (<span style="font-size: 13.3333px;">already segmented into trials, </span><span style="font-size: 10pt;">as shown in the tutorial):</span></div>
<div><br>
</div>
<div>
<pre class="code matlab" style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; color: rgb(51, 51, 51); background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; white-space: pre-wrap;">spikeTrials = 
         label: <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">{</span><span class="co2" style="box-sizing: border-box; color: rgb(51, 153, 51);">'sig002a_wf'</span>  <span class="co2" style="box-sizing: border-box; color: rgb(51, 153, 51);">'sig003a_wf'</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">}</span>
     timestamp: <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">{</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x83601 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/int32.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">int32</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span>  <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x61513 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/int32.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">int32</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">}</span>
      waveform: <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">{</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x32x83601 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">double</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span>  <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x32x61513 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">double</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">}</span>
          unit: <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">{</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x83601 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">double</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span>  <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x61513 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">double</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">}</span>
           hdr: <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x1 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/struct.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">struct</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span>
        dimord: <span class="co2" style="box-sizing: border-box; color: rgb(51, 153, 51);">'{chan}_lead_time_spike'</span>
           cfg: <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x1 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/struct.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">struct</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span>
          time: <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">{</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x83601 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">double</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span>  <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x61513 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">double</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">}</span>
         trial: <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">{</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x83601 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">double</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span>  <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>1x61513 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">double</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">}</span>
     trialtime: <span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">[</span>600x2 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing: border-box; background-color: transparent; color: rgb(51, 153, 243); text-decoration-line: none;"><span class="kw2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-weight: bold;">double</span></a><span class="br0" style="box-sizing: border-box; color: rgb(102, 204, 102);">]</span></pre>
</div>
<div><br>
</div>
<div>The fields ".waveform" and ".unit" won't be necessary for spike-field coherence. </div>
<div>For the fields ".cfg" and ".hdr", I am not sure if they are used at some point. I fill them with the info I have. </div>
<div>spikeTrials.hdr.FileHeader.Frequency = your SamplingFrequency; % 40000 </div>
<div>
<div style="font-size: 13.3333px;">spikeTrials.cfg.timestampspersecond = your SamplingFrequency; % 40000 </div>
</div>
<div><span style="font-size: 13.3333px;">spikeTrials.cfg.trl = nTrials x 3 matrix with start (1st column), end (2nd) and offset relative to trigger (3rd) of each trial in timestamp units.</span></div>
<div><span style="font-size: 13.3333px;"><br>
</span></div>
<div><span style="font-size: 10pt;">".label" contains a cell array of strings with one string for each unit. ".dimord" can be copied from above. </span></div>
<div><span style="font-size: 10pt;">".trialtime" = nTrials x 2 matrix with start (1st) / end (2nd) of each trial relative to trigger in seconds. </span></div>
<div><span style="font-size: 10pt;"><br>
</span></div>
<div><span style="font-size: 10pt;">The important fields are ".timestamp", ".time", ".trial". Those contain all info about each spike for each unit (1 x nUnits cell array, each cell contains a vector with one entry per spike for that unit).  </span></div>
<div><span style="font-size: 10pt;"><br>
</span></div>
<div>".timestamp": spike times in timestamp units from the beginning of the recording (NOTE: Make sure your recording is continuous such that the timestamps increase from first to last, no clock resets to zero).</div>
<div><br>
</div>
<div>".time": spike times in seconds relative to trigger in each trial </div>
<div><br>
</div>
<div>".trial": trial number in which the spike occurred (1 for trial 1, 2 for 2 and so on)</div>
<div><br>
</div>
<div>Best,</div>
<div>Andreas</div>
<div><br>
</div>
<div>  </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF520487" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> fieldtrip-bounces@science.ru.nl [fieldtrip-bounces@science.ru.nl] on behalf of Julia Coopi [juliacoopiza@gmail.com]<br>
<b>Sent:</b> Wednesday, August 23, 2017 5:16 PM<br>
<b>To:</b> fieldtrip@science.ru.nl<br>
<b>Subject:</b> [FieldTrip] Using PPC method<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div>
<div>Dear Fieldtrippers,<br>
<br>
</div>
I am new in fieltrip. I want to use pair wise phase consistency method for measuring the spike-pahse locking. My data set is recorded by neuralynx. For measuring it I found this link:
<a href="http://www.fieldtriptoolbox.org/tutorial/spikefield" target="_blank">http://www.fieldtriptoolbox.or<wbr>g/tutorial/spikefield</a>. Is it the right link? Should I go through all steps including reading spikes and LFPs from neuralynx, make trails and
 .... finally call thefollowing function?<br>
<pre class="gmail-m_7187508087532686841gmail-m_-6685665513038556996gmail-code gmail-m_7187508087532686841gmail-m_-6685665513038556996gmail-matlab" style="overflow:auto; font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; display:block; padding:9.5px; margin:0px 0px 10px; line-height:1.42857; word-break:break-all; color:rgb(51,51,51); background-color:rgb(245,245,245); border-width:1px; border-style:solid; border-color:rgb(204,204,204); white-space:pre-wrap; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; word-spacing:0px">ft_spiketriggeredspectrum</pre>
It is very boring and time consuming. Actually, I imported files into matlab and make the trials which was a huge work at that time. I don't want to do it again and import data from neuralynx by fieldtrip (which seems is not very straighforward). I want to
 use the PPC method of fieldtrip using imported files into matlab. Is there any way to do that?<br>
</div>
<div>Please guide me what is the best way.<br>
<br>
</div>
<div>Thanks,<br>
</div>
Julia</div>
</div>
</div>
</div>
</div>
</body>
</html>