[FieldTrip] ft_preamble errors in ft_timelockstatistics
Schoffelen, J.M. (Jan Mathijs)
janmathijs.schoffelen at donders.ru.nl
Wed Jun 22 08:51:52 CEST 2022
Hi Jaewon,
You may want to check the contents of the cfg that you used for the call to ft_timelockstatistics. The error suggests that there’s a cfg.inputfile specified. This is not allowed, if you also supply the function with data arguments in the input.
Best wishes,
Jan-Mathijs
On 22 Jun 2022, at 06:22, 오재원 via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
Hello,
I was trying clust-based permutation test using fieldtrip and I got no error until here.
I brought EEG data and conducted timelock analysis for each condition, and then conducted permutation test with montecarlo.
%% Import data from BVA addpath C:\ addpath C:\Export addpath C:\Developmental-Neuroscience-Lab-Toolbox-main\Network addpath C:\fieldtrip-master ft_defaults allSubj = {'01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '1 3', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26'}; condition = {'CSD', 'CSD2', 'CSD3', 'CSD4'}; for c = 1:length(condition) for s = 1:length(allSubj) filename = ['C:\Export\p',allSubj{s},'_',condition{c}]; data = BVA2Matlab(filename); save(['Subj_',allSubj{s}, '_ERP_', condition{c}, 'data'], 'data'); end end %% timelock analysis %CSD datapath = "C:\Export\HH"; nSubjs = numel(allSubj); for i = 1:nSubjs fileName = strcat('Subj_', allSubj{i}, '_ERP_CSDdata.mat'); dataSet = fullfile('C:', 'Export', 'HH', fileName); save dataSet dataSet load dataSet cfg = []; cfg.inputfile = dataSet; cfg.keeptrials = 'yes'; HH_timelock = ft_timelockanalysis(cfg); save HH_timelock HH_timelock; end %CSD2 datapath = "C:\Export\HN"; nSubjs = numel(allSubj); for i = 1:nSubjs fileName2 = strcat('Subj_', allSubj{i}, '_ERP_CSD2data.mat'); dataSet2 = fullfile('C:', 'Export', 'HN', fileName2); save dataSet2 dataSet2 load dataSet2 cfg = []; cfg.inputfile = dataSet2; cfg.keeptrials = 'yes'; HN_timelock = ft_timelockanalysis(cfg); save HN_timelock HN_timelock; end %CSD3 datapath = "C:\Export\LH"; nSubjs = numel(allSubj); for i = 1:nSubjs fileName3 = strcat('Subj_', allSubj{i}, '_ERP_CSD3data.mat'); dataSet3 = fullfile('C:', 'Export', 'LH', fileName3); save dataSet3 dataSet3 load dataSet3 cfg = []; cfg.inputfile = dataSet3; cfg.keeptrials = 'yes'; LH_timelock = ft_timelockanalysis(cfg); save LH_timelock LH_timelock; end %CSD4 datapath = "C:\Export\LN"; nSubjs = numel(allSubj); for i = 1:nSubjs fileName4 = strcat('Subj_', allSubj{i}, '_ERP_CSD4data.mat'); dataSet4 = fullfile('C:', 'Export', 'LN', fileName4); save dataSet4 dataSet4 load dataSet4 cfg = []; cfg.inputfile = dataSet4; cfg.keeptrials = 'yes'; LN_timelock = ft_timelockanalysis(cfg); save LN_timelock LN_timelock; end %% Permutation test [ftver, ftpath] = ft_version; cd(fullfile(ftpath, 'template', 'electrode')); elec = ft_read_sens('standard_1020.elc'); % there are some of which the orientation cannot be determined (T3, T4, T5, T6) ft_plot_sens(elec, 'label', 'yes', 'elecshape', 'disc', 'elecsize', 10, 'facecolor', [0.8 0.8 1.0]) % give it a stronger 3D appearance camlight headlight cfg = []; cfg.elec = elec; cfg.channel = {'Fp1', 'Fpz', 'Fp2', 'F7', 'F3', 'Fz', 'F4', 'F8', 'T7', 'C3', 'Cz', 'C4', 'T8', 'P7', 'P3', 'Pz', 'P4', 'P8', 'O1', 'Oz', 'O2'}; cfg.method = 'distance'; cfg.feedback = 'yes'; cfg.neighbourdist = 100; neighbours = ft_prepare_neighbours(cfg); design = zeros(4, nSubjs*4); design(1,:) = [1:nSubjs 1:nSubjs 1:nSubjs 1:nSubjs]; design(2,:) = [ones(1,nSubjs) ones(1,nSubjs)*2 ones(1,nSubjs)*3 ones(1,nSubjs)*4]; cfg = []; cfg.channel = {'EEG'}; cfg.latency = [0 0.6]; cfg.method = 'montecarlo'; cfg.neighbours = neighbours; cfg.statistic = 'ft_statfun_depsamplesFmultivariate'; cfg.correctm = 'cluster'; cfg.clusteralpha = 0.05; cfg.clusterstatistic = 'maxsum'; cfg.minnbchan = 2; cfg.tail = 0; cfg.clustertail = 0; cfg.alpha = 0.025; cfg.numrandomization = 500; cfg.design = design; cfg.uvar = 1; cfg.ivar = 2;
After this, however, when I ran the code below,
%% permutation test statistical analysis
[stat] = ft_timelockstatistics(cfg, HH_timelock, HN_timelock, LH_timelock, LN_timelock);
I got some errors as follows:
Error: ft_preamble_loadvar (line 65)
cfg.inputfile should not be used in conjunction with giving input data to this function
Error: ft_preamble (line 83)
evalin('caller', full_cmd);
Error: ft_timelockstatistics (line 70)
ft_preamble loadvar varargin
I could not find the cause of these errors from my code or any solution.
How can I solve this problem?
Please help me...
Best,
Jaewon Oh
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!40CauTH0jdMhnls91YO8DieQB7neqwhLMANJdFUm1F0QyVwV70iHMb_PxxR5XsRnpHKU4t3h3NyyH5aZkBcvH8lyva1wj-u9I5xSxw$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220622/2c68b7b4/attachment.htm>
More information about the fieldtrip
mailing list