<div dir="ltr"><div>Hi Fieldtrip Community, <br></div><div><br></div><div>We are currently trying to run a wavelet time frequency analysis. Our EEG data is already preprocessed and epoched with EEGlab. We are able to read in the data, define trials, and output values for TFR.powspctrm. However, we do not see any of these values plotted on our figure with ft_singleplot. <br></div><div><br></div><div>This is the code we are using: <br></div><div><br>cfg = [];                                          <br>cfg.dataset                  = dsname;     <br>cfg.continuous             = 'no';<br>cfg.trialfun                   = 'wm_trialfun'; <br>cfg.binNumber             = 13;<br>cfg.epochBaseInt         = -0.5; <br>cfg.epochInt                 = 1.5; <br>cfg.trialdef.prestim        = cfg.epochBaseInt - 0.01; <br>cfg.trialdef.poststim       = cfg.epochInt - 0.01 ;<br>cfg = ft_definetrial(cfg);         <br>dataFIC = ft_preprocessing(cfg);<br>save dataFIC_DirCue dataFIC;<br>dataFIC_condX<br><br>cfg = [];<br>cfg.channel    = 'EEG';                    <br>cfg.trials     = 'all' <br>cfg.keeptrials = 'no'; <br>cfg.output     = 'pow';    <br>cfg.foi        = 2:0.5:50;<br>cfg.toi        = -0.4:0.01:1.4; %<br>cfg.method     = 'wavelet';<br>cfg.width      = 7; <br>cfg.length     = 2; <br>TFR = ft_freqanalysis(cfg, dataFIC);<br>save TFRwave_DirCue TFR<br><br>% plot the results<br>cfg = [];<br>cfg.parameter = 'powspctrm';<br>cfg.baseline     = [-0.4 0]; <br>cfg.baselinetype = 'relative';             <br>cfg.zlim         = [-3e-10 3e-10]; <br>cfg.showlabels   = 'yes';        <br>figure;<br>ft_singleplotTFR(cfg,TFR);<br><br><br>And this is our trial_function:<br><br>function [trl, event] = wm_trialfun(cfg);<br>hdr   = ft_read_header(cfg.dataset);<br>event = ft_read_event(cfg.dataset);<br>indx=[];<br>if cfg.binNumber<br>    for i = 1:size(event,2)<br>    if ismember(cfg.binNumber,event(i).bini)<br>    indx=[indx;1];<br>    else indx=[indx;0];<br>    end<br>    end<br>    ind = find(indx);<br>    sample = [event(ind).sample]';<br>else<br>    sample = [event(find(strcmp(cfg.codeLabel, {event.codelabel}))).sample]';<br>end<br>epochBaseSamples = -1*cfg.epochBaseInt*hdr.Fs;<br>epochSamples = cfg.epochInt*hdr.Fs;<br>epochTotal = epochBaseSamples + epochSamples;<br>epochStarts = [1:epochTotal:sample(end)];<br>eventStarts = epochStarts + epochBaseSamples;<br>sampleGood = intersect(sample,eventStarts);<br>pretrig  = -round(cfg.trialdef.prestim  * hdr.Fs);<br>posttrig =  round(cfg.trialdef.poststim * hdr.Fs);<br>trl = [];<br>trl(:,1) = sampleGood + pretrig;  <br>trl(:,2) = sampleGood + posttrig; <br>trl(:,3) = pretrig; <br><br></div><div>And this is the cfg:<br><br>channel: {128x1 cell}<br>               trials: 'all'<br>           keeptrials: 'no'<br>               output: 'pow'<br>                  foi: [1x15 double]<br>                  toi: [1x28 double]<br>               method: 'wavelet'<br>                width: 7<br>               length: 3<br>    outputfilepresent: 'overwrite'<br>             callinfo: [1x1 struct]<br>              version: [1x1 struct]<br>             feedback: 'text'<br>            inputlock: []<br>           outputlock: []<br>               gwidth: 3<br>                  pad: 0.9820<br>              padtype: 'zero'<br>              calcdof: 'no'<br>            precision: 'double'<br>     correctt_ftimwin: 'no'<br>          polyremoval: 0<br>           keeptapers: 'no'<br>             previous: [1x1 struct]<br><br><br></div><div>Any insights would be greatly appreciated with regards to why we cannot see any values in our single plot figure. Also, we are not sure if the problem rests in our plotting configuration or the data itself.<br><br></div><div>Best regards, <br></div><div>Ella<br><br></div></div>