<div class="gmail_quote">

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New"">Dear Fieldtrip users, <br></span></p>
<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New""><br></span></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left">


<span style="font-size:10.0pt;font-family:"Courier New"">I have a problem with using a trial selection to do freqdescriptives on a subset of trials:<br></span></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left">


<br><span style="font-size:10.0pt;font-family:"Courier New""></span></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New"">I first do ft_freqanalysis with these setttings, which results in freq:</span></p>


<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New""><br></span></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left">


<span style="font-size:10.0pt;font-family:"Courier New"">cfg.output<span>      </span>= </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'fourier'</span><span style="font-size:10.0pt;font-family:"Courier New"">;</span><span style="font-size:12.0pt;font-family:"Courier New""></span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New"">cfg.method<span>      </span>= </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'mtmconvol'</span><span style="font-size:10.0pt;font-family:"Courier New"">;</span><span style="font-size:12.0pt;font-family:"Courier New""></span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New"">cfg.keeptrials<span>  </span>= </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'yes'</span><span style="font-size:10.0pt;font-family:"Courier New"">;</span><span style="font-size:12.0pt;font-family:"Courier New""></span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New"">freq = </span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>            </span>label: {1x64 cell}</span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>           </span>dimord: 'rpttap_chan_freq_time'</span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>             </span>freq: [30 35 40 45 50 55 60 65 70
75 80 85 90 95 100]</span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>             </span>time: [1x36 double]</span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>    </span>fourierspctrm: [4-D double]</span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>        </span>cumtapcnt: [857x15 double]</span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>              </span>cfg: [1x1 struct]</span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New"">size(freq.fourierspctrm)</span></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left">


<span style="font-size:12.0pt;font-family:"Courier New"">ans =</span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>        </span>2571<span>          </span>64<span>          </span>15<span>          </span>36</span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""> </span></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left">


<span style="font-size:12.0pt;font-family:"Courier New"">then i try running ft_freqdescriptives with these settings<br></span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New"">tmpcfg = [];</span><span style="font-size:12.0pt;font-family:"Courier New""></span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New""><span>        </span>tmpcfg.jackknife = </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'no'</span><span style="font-size:10.0pt;font-family:"Courier New"">;</span><span style="font-size:12.0pt;font-family:"Courier New""></span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New""><span>        </span>tmpcfg.keeptrials = </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'no'</span><span style="font-size:10.0pt;font-family:"Courier New"">;</span><span style="font-size:12.0pt;font-family:"Courier New""></span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New""><span>        </span>tmpcfg.channel<span>    </span>= freq.label([chnix1,chnix2])</span><span style="font-size:12.0pt;font-family:"Courier New""></span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New""><span>        </span>tmpcfg.trials<span>     </span>= [1:10:100];</span><span style="font-size:12.0pt;font-family:"Courier New""></span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:10.0pt;font-family:"Courier New""><span>        </span>tmp = ft_freqdescriptives(tmpcfg,freq);</span><span style="font-size:12.0pt;font-family:"Courier New""></span></p>




<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New"">Error using<span>  </span>+ </span></p>


<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New"">Array dimensions must match
for binary array op.</span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New"">Error in
ft_checkdata>fixcsd (line 740)</span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>      </span>powspctrm = powspctrm +
abs(data.fourierspctrm(p:ntap:end,:,:,:,:)).^2;</span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New"">Error in ft_checkdata (line
646)</span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><span>    </span>data = fixcsd(data, cmbrepresentation,
channelcmb);</span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New"">Error in ft_freqdescriptives
(line 131)</span></p>

<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New"">freq = ft_checkdata(freq,
'cmbrepresentation', 'sparsewithpow', 'channelcmb', {});</span></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><br><span style="font-size:12.0pt;font-family:"Courier New""></span></p>


<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left">the error seems to happen because the <span style="font-size:12.0pt;font-family:"Courier New"">cumtapcnt seems to be updated </span>after calling ft_selectdata in ft_freqdescriptives such that it no longer contains a row for every trial which causes nrpt = size(data.cumtapcnt,1); in ft_checkdata to return 1 instead of the number of trials. <br>


</p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><br></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left">


            label: {2x1 cell}<br>           dimord: 'rpttap_chan_freq_time'<br>             freq: [30 35 40 45 50 55 60 65 70 75 80 85 90 95 100]<br>             time: [1x36 double]<br>    fourierspctrm: [4-D double]<br>


        cumtapcnt: [3 3 3 3 3 3 3 3 3 3]<br>              cfg: [1x1 struct]<br></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><br></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left">


I was wondering if this is a bug or am I somehow specifying the input incorrectly?</p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><br></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left">


Thanks! best, Jasper<br></p><p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><br><span style="font-size:12.0pt;font-family:"Courier New""></span></p>


<p class="MsoNormal" style="text-align:left;text-indent:0cm;line-height:normal;text-autospace:none" align="left"><span style="font-size:12.0pt;font-family:"Courier New""><br></span></p>

</div><br>