<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Poppy,</p>
<div><br>
</div>
<div>You've asked not to keep the trials (cfg.keeptrials = 'no'), but then propagated that cfg to your call to ft_singleplotTFR. So fieldtrip is reading the cfg.trials field again at plotting and is trying to find the trials again in 'freqdata'. But there aren't
 any trials there anymore.</div>
<div><br>
</div>
<div>If you change cfg.keeptrials = 'yes' in your call to ft_freqanalysis this code will work. Alternatively add a cfg = [] before the call to ft_singleplotTFR.</div>
<div><br>
</div>
<div>Best,</div>
<div>Tom<br>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> fieldtrip <fieldtrip-bounces@science.ru.nl> on behalf of Poppy Watson <popwatson@hotmail.com><br>
<b>Sent:</b> 03 August 2018 06:23:00<br>
<b>To:</b> fieldtrip@science.ru.nl<br>
<b>Subject:</b> [FieldTrip] Issues with TF analysis and plotting</font>
<div> </div>
</div>
<meta content="text/html; charset=Windows-1252">
<meta name="x_Generator" content="Microsoft Word 15 (filtered medium)">
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:x_link, span.x_MsoHyperlink
        {color:#0563C1;
        text-decoration:underline}
a:x_visited, span.x_MsoHyperlinkFollowed
        {color:#954F72;
        text-decoration:underline}
span.x_EmailStyle17
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-family:"Calibri",sans-serif}
@page WordSection1
        {margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.x_WordSection1
        {}
-->
</style>
<div lang="EN-AU" link="#0563C1" vlink="#954F72">
<div class="x_WordSection1">
<p class="x_MsoNormal">Dear all,</p>
<p class="x_MsoNormal">Sorry for this simple question but I am unable to work out what I am doing wrong.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">I am working through a TF analysis using all the online tutorials etc. I’m interested in the time window 1 second before the trigger but have taken a 2 second window (0.5 seconds either side of the bit I am interested in). Everything
 seems to be going ok and the freq.powspctrm object seems to be the correct size but when plotting my results (using any of the multiplot, singeplot or topoplot methods) I keep getting the error message:
<i>incorrect specification of cfg.trials for data without repetitions.</i></p>
<p class="x_MsoNormal">See here some example code:</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">  cfg.trials  = highValSuccessTrials;
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:forestgreen">% this is a vector of trial numbers</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">  cfg.method =
</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"; color:black">;
</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">  cfg.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"; color:black">;</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">  cfg.output =
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:#A020F0">'pow'</span><span style="font-size:10.0pt; font-family:"Courier New"; color:black">;</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black"> 
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:forestgreen">cfg.channel = 'eeg';
</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">  cfg.taper =
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:#A020F0">'hanning'</span><span style="font-size:10.0pt; font-family:"Courier New"; color:black">;</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">  cfg.foi   = 2:2:30;</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">  cfg.t_ftimwin    = ones(length(cfg.foi),1).*2;  
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:forestgreen">% length of time window = 2 sec</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">  cfg.toi          = -1.5:0.05:0.5;                 
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:forestgreen">% time window "slides" from -1.5 to 0.5 sec (0.5 s after stim presentation) in steps of 0.05 sec (50 ms)</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">  freqdata = ft_freqanalysis(cfg, preProcData);</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt; font-family:"Courier New""> </span></p>
<p class="x_MsoNormal">%%plotting</p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">cfg.baseline     = [-1.5 -1.1];
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:forestgreen">% this is just before my 1 sec of interest</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">cfg.baselinetype =
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:#A020F0">'absolute'</span><span style="font-size:10.0pt; font-family:"Courier New"; color:black">;
</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">cfg.maskstyle    =
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:#A020F0">'saturation'</span><span style="font-size:10.0pt; font-family:"Courier New"; color:black">;   
</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">cfg.channel      =
</span><span style="font-size:10.0pt; font-family:"Courier New"; color:#A020F0">'FcZ'</span><span style="font-size:10.0pt; font-family:"Courier New"; color:black">;</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">figure
</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:"Courier New"; color:black">ft_singleplotTFR(cfg, freqdata);</span><span style="font-size:12.0pt; font-family:"Courier New""></span></p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Much appreciated!</p>
<p class="x_MsoNormal"><b><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#757B80">---------------------------------------------------------------------</span></b><span style="font-size:12.0pt; color:black"><br>
P. Watson</span></p>
<p class="x_MsoNormal"> </p>
</div>
</div>
</body>
</html>