[FieldTrip] ft_singleplotTFR issues.
Schoffelen, J.M. (Jan Mathijs)
jan.schoffelen at donders.ru.nl
Mon Mar 4 17:33:36 CET 2019
Hi Marion,
The assertion on line 177 (in the current version of the code this is line 178) of ft_singleplotTFR checks for the presence of a ‘freq’ and ‘time’ field in your data. It seems as if your data doesn’t meet this expectation. Hence the error.
Jan-Mathijs
J.M.Schoffelen, MD PhD
Senior Researcher, VIDI-fellow - PI, language in interaction
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands
On 4 Mar 2019, at 16:02, Marion Vincent <marion.vincent at univ-lille.fr<mailto:marion.vincent at univ-lille.fr>> wrote:
Dear all,
I’m having some troubles using the ft_singleplotTFR for time-frequency analysis.
I’ve tried 2 different TF analysis : 'mtmfft' for low frequencies and ‘'mtmconvol'’ for high frequencies.
However I’ve got the Following error for the single plot of the low freq TF (but it works for high freq TF).
****************************
Error using ft_singleplotTFR (line 177)
please use ft_singleplotER for time-only or frequency-only data
****************************
Does anyone have any idea ? I’ve put the entire code below.
Thanks !
Marion
%% TIME-FREQUENCY ANALYSIS
close all
clear all
%% ************************ INITIALIZATION ******************
%% Parameters to change
EXP = '1';
seg_window = [1 1.1]; % in seconds %preStim/postStim
cond = 1; % number of the experimental condition 1 to 4
Baseline_Window = [-1 0] ; %as the baseline lasts 1s before the stimulus onset
%% initialize fieldtrip
startup()
%% initialize paths
path_Biosemi = 'C:\Users\Marion\Documents\EEG\Prosodie - Angele\AV-Exps';
path_data='C:\Users\Marion\Documents\MATLAB\EEG_AV-Exps';
%% subjects list
load(fullfile(path_data, 'data', 'Participants_List.mat'));
for i=1:27
subjects{i,1}=list_Participants(i);
end
clear list_Participants i
%% ************************ TIME-FREQUENCY DOMAIN ANALYSIS --- WANG et al. 2017 %%%%%%%%
% LOW FREQUENCIES: 2-30 Hz => Hanning multitaper %% fixed window length
% HIGH FREQUENCIES: 25-100 Hz => Slepian multitaper
tic
nsubj = 4;%numel(subjects);
tfreq_Low = cell(1,nsubj);
tfreq_High = cell(1,nsubj);
for i=1:nsubj
% load the erp data
datapath = strcat(path_data, '/data')
results_path=fullfile(datapath,['Participant_' num2str(subjects{i})]);
datafile = fullfile(results_path, ['erp_Cond' num2str(cond) '.mat']);
% load the ERP data of subject i from disk
load(datafile);
erp=eval(['ERP_cond' num2str(cond)]);
% Low-frequencies 2-30 Hz
cfg = [];
cfg.output = 'pow';
cfg.method = 'mtmfft';
cfg.taper = 'hanning';
cfg.foi = 2:2:30; % analysis 2 to 30 Hz in steps of 2 Hz
cfg.t_ftimwin = ones(length(cfg.foi),1).*0.5; % length of time window = 0.5 sec
cfg.toi = -1:0.05:1.1; % time window "slides" from -1 to 1.1 sec in steps of 0.05 sec (50 ms)
tfreq_Low = ft_freqanalysis(cfg, erp);
% % Visualization single plot
% cfg = [];
% cfg.channel = {'A1'};
% figure
% ft_singleplotTFR(cfg, tfreq_Low);
% High frequencies 25-100 Hz
cfg = [];
cfg.output = 'pow';
cfg.method = 'mtmconvol';
cfg.taper = 'dpss';
cfg.foi = 25:5:100; % analysis 25 to 100 Hz in steps of 5 Hz
cfg.tapsmofrq = ones(length(cfg.foi),1).*20 % vector 1 x numfoi, the amount of spectral smoothing through multi-tapering.
% Note that 4 Hz smoothing means plus-minus 4 Hz, i.e. a 8 Hz smoothing box.
cfg.t_ftimwin = ones(length(cfg.foi),1).*0.2; % length of time window = 0.2 sec FIXED
cfg.toi = -1:0.05:1.1; % time window "slides" from -0.1 to 1 sec in steps of 0.01 sec (10 ms)
tfreq_High = ft_freqanalysis(cfg, erp);
% Visualization single plot
cfg = [];
cfg.channel = {'A1'};
figure
ft_singleplotTFR(cfg, tfreq_High);
% Visualization single plot
cfg = [];
cfg.layout = 'C:\Users\Marion\Documents\MATLAB\EEG_AV-Exps\biosemi128.lay';
ft_multiplotTFR(cfg, TFRhann_HF);
end
Marion VINCENT
Eng., PhD , CNRS Research Engineer
Tel: +33 607 59 46 76
Laboratoire SCALab UMR CNRS 9193
Université Lille 3
BP 60149
59653 Villeneuve d'Ascq Cedex
http://scalab.cnrs.fr<http://scalab.cnrs.fr/>
--------------------------------------------
L’Imaginarium / SCV-IrDIVE Equipex
99a Boulevard Descat
59200 Tourcoing
http://www.irdive.fr<http://www.irdive.fr/>/<http://www.irdive.fr/>
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190304/6cd53875/attachment-0002.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
More information about the fieldtrip
mailing list