<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang="FR"><div class="WordSection1"><p class="MsoNormal">Dear all, </p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">I’m having some troubles using the ft_singleplotTFR for time-frequency analysis. </p><p class="MsoNormal">I’ve tried 2 different TF analysis : 'mtmfft' for low frequencies and ‘'mtmconvol'’ for high frequencies. </p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">However I’ve got the Following error for the single plot of the low freq TF (but it works for high freq TF).</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">****************************<o:p></o:p></p><p class="MsoNormal">Error using ft_singleplotTFR (line 177)<o:p></o:p></p><p class="MsoNormal">please use ft_singleplotER for time-only or frequency-only data<o:p></o:p></p><p class="MsoNormal">****************************<o:p></o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">Does anyone have any idea ? I’ve put the entire code below. </p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">Thanks ! </p><p class="MsoNormal">Marion</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">%% TIME-FREQUENCY ANALYSIS</p><p class="MsoNormal">close all</p><p class="MsoNormal">clear all</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">%% ************************ INITIALIZATION ******************</p><p class="MsoNormal">%% Parameters to change</p><p class="MsoNormal">EXP = '1';</p><p class="MsoNormal">seg_window = [1 1.1]; % in seconds %preStim/postStim</p><p class="MsoNormal">cond = 1; % number of the experimental condition 1 to 4</p><p class="MsoNormal">Baseline_Window = [-1 0] ; %as the baseline lasts 1s before the stimulus onset</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">%% initialize fieldtrip</p><p class="MsoNormal">startup()</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">%% initialize paths</p><p class="MsoNormal">path_Biosemi = 'C:\Users\Marion\Documents\EEG\Prosodie - Angele\AV-Exps';</p><p class="MsoNormal">path_data='C:\Users\Marion\Documents\MATLAB\EEG_AV-Exps';</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">%% subjects list</p><p class="MsoNormal">load(fullfile(path_data, 'data', 'Participants_List.mat'));</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">for i=1:27</p><p class="MsoNormal"> subjects{i,1}=list_Participants(i);</p><p class="MsoNormal">end</p><p class="MsoNormal">clear list_Participants i</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">%% ************************ TIME-FREQUENCY DOMAIN ANALYSIS --- WANG et al. 2017 %%%%%%%%</p><p class="MsoNormal">% LOW FREQUENCIES: 2-30 Hz => Hanning multitaper %% fixed window length</p><p class="MsoNormal">% HIGH FREQUENCIES: 25-100 Hz => Slepian multitaper</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">tic</p><p class="MsoNormal">nsubj = 4;%numel(subjects);</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">tfreq_Low = cell(1,nsubj);</p><p class="MsoNormal">tfreq_High = cell(1,nsubj);</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">for i=1:nsubj</p><p class="MsoNormal"> % load the erp data</p><p class="MsoNormal"> datapath = strcat(path_data, '/data')</p><p class="MsoNormal"> results_path=fullfile(datapath,['Participant_' num2str(subjects{i})]);</p><p class="MsoNormal"> </p><p class="MsoNormal"> datafile = fullfile(results_path, ['erp_Cond' num2str(cond) '.mat']);</p><p class="MsoNormal"> % load the ERP data of subject i from disk</p><p class="MsoNormal"> load(datafile);</p><p class="MsoNormal"> </p><p class="MsoNormal"> erp=eval(['ERP_cond' num2str(cond)]);</p><p class="MsoNormal"> </p><p class="MsoNormal"> % Low-frequencies 2-30 Hz</p><p class="MsoNormal"> cfg = [];</p><p class="MsoNormal"> cfg.output = 'pow';</p><p class="MsoNormal"> cfg.method = 'mtmfft';</p><p class="MsoNormal"> cfg.taper = 'hanning';</p><p class="MsoNormal"> cfg.foi = 2:2:30; % analysis 2 to 30 Hz in steps of 2 Hz</p><p class="MsoNormal"> cfg.t_ftimwin = ones(length(cfg.foi),1).*0.5; % length of time window = 0.5 sec</p><p class="MsoNormal"> cfg.toi = -1:0.05:1.1; % time window "slides" from -1 to 1.1 sec in steps of 0.05 sec (50 ms)</p><p class="MsoNormal"> tfreq_Low = ft_freqanalysis(cfg, erp);</p><p class="MsoNormal"> </p><p class="MsoNormal">% % Visualization single plot</p><p class="MsoNormal">% cfg = [];</p><p class="MsoNormal">% cfg.channel = {'A1'}; </p><p class="MsoNormal">% figure</p><p class="MsoNormal">% ft_singleplotTFR(cfg, tfreq_Low);</p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal"> % High frequencies 25-100 Hz</p><p class="MsoNormal"> cfg = [];</p><p class="MsoNormal"> cfg.output = 'pow';</p><p class="MsoNormal"> cfg.method = 'mtmconvol';</p><p class="MsoNormal"> cfg.taper = 'dpss';</p><p class="MsoNormal"> cfg.foi = 25:5:100; % analysis 25 to 100 Hz in steps of 5 Hz</p><p class="MsoNormal"> cfg.tapsmofrq = ones(length(cfg.foi),1).*20 % vector 1 x numfoi, the amount of spectral smoothing through multi-tapering.</p><p class="MsoNormal"> % Note that 4 Hz smoothing means plus-minus 4 Hz, i.e. a 8 Hz smoothing box.</p><p class="MsoNormal"> cfg.t_ftimwin = ones(length(cfg.foi),1).*0.2; % length of time window = 0.2 sec FIXED</p><p class="MsoNormal"> cfg.toi = -1:0.05:1.1; % time window "slides" from -0.1 to 1 sec in steps of 0.01 sec (10 ms)</p><p class="MsoNormal"> tfreq_High = ft_freqanalysis(cfg, erp);</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"> % Visualization single plot</p><p class="MsoNormal"> cfg = [];</p><p class="MsoNormal"> cfg.channel = {'A1'}; </p><p class="MsoNormal"> figure</p><p class="MsoNormal"> ft_singleplotTFR(cfg, tfreq_High);</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"> % Visualization single plot</p><p class="MsoNormal"> cfg = [];</p><p class="MsoNormal"> cfg.layout = 'C:\Users\Marion\Documents\MATLAB\EEG_AV-Exps\biosemi128.lay';</p><p class="MsoNormal"> ft_multiplotTFR(cfg, TFRhann_HF);</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">end</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><b><span style="color:#2F5597">Marion VINCENT</span></b><span style="color:black"><br>Eng., PhD , CNRS Research Engineer<br><b>Tel</b>: +33 607 59 46 76<br><br>Laboratoire SCALab UMR CNRS 9193<br>Université Lille 3<br>BP 60149<br>59653 Villeneuve d'Ascq Cedex<br><i>http://scalab.cnrs.fr</i><br>--------------------------------------------<br>L’Imaginarium / SCV-IrDIVE Equipex<br>99a Boulevard Descat<br>59200 Tourcoing<br><i>http://www.irdive.fr</i>/</span><o:p></o:p></p><p class="MsoNormal"><o:p> </o:p></p></div></body></html>