<p style="border:0; padding:0; margin:0; font-family:'굴림'; font-size:10pt; cursor: text;"><p style="font-family: 굴림; font-size: 10pt; border: 0px; padding: 0px; margin: 0px; cursor: text;"><br></p><p style="font-family: 굴림; font-size: 10pt; border: 0px; padding: 0px; margin: 0px; cursor: text;"><br></p><div class="paragraphNode wrappable" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; box-sizing: border-box; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);"><span class="textBox" style="box-sizing: border-box;">Hello,</span></div><div class="paragraphNode wrappable" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; box-sizing: border-box; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);"><span class="textBox" style="box-sizing: border-box;">I was trying clust-based permutation test using fieldtrip and I got no error until here.</span></div><div class="paragraphNode wrappable" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; box-sizing: border-box; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);"><span class="textBox" style="box-sizing: border-box;">I brought EEG data and conducted timelock analysis for each condition, and then conducted permutation test with montecarlo.</span></div><div class="paragraphNode wrappable" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; box-sizing: border-box; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);"><br></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><font face="Helvetica, Arial, sans-serif" style=""><span style="font-size: 14px; white-space: pre-wrap; background-color: rgb(204, 255, 204);">%% 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;</span></font></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><br></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; white-space: pre-wrap; background-color: rgb(255, 255, 255);">After this, however, when I ran the code below,</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="background-color: rgb(204, 255, 204);">%% permutation test statistical analysis</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="background-color: rgb(204, 255, 204);">[stat] = ft_timelockstatistics(cfg, HH_timelock, HN_timelock, LH_timelock, LN_timelock);</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><br></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; white-space: pre-wrap; background-color: rgb(255, 255, 255);">I got some errors as follows:</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><br></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-size: 13.3333px; background-color: rgb(204, 255, 204);">Error: ft_preamble_loadvar (line 65)</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-size: 13.3333px; background-color: rgb(204, 255, 204);">cfg.inputfile should not be used in conjunction with giving input data to this function</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-size: 13.3333px; background-color: rgb(204, 255, 204);"><br></span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-size: 13.3333px; background-color: rgb(204, 255, 204);">Error: ft_preamble (line 83)</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-size: 13.3333px; background-color: rgb(204, 255, 204);">evalin('caller', full_cmd);</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-size: 13.3333px; background-color: rgb(204, 255, 204);"><br></span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-size: 13.3333px; background-color: rgb(204, 255, 204);">Error: ft_timelockstatistics (line 70)</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><span style="font-size: 13.3333px; background-color: rgb(204, 255, 204);">ft_preamble loadvar varargin</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><br></div><div class="paragraphNode wrappable" style="box-sizing: border-box; margin: 2px 10px 10px 4px; line-height: 1.5; min-height: 17px; overflow: auto;"><div class="paragraphNode wrappable" style="box-sizing: border-box; font-family: Helvetica, Arial, sans-serif; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; font-size: 14px; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);"><span class="textBox" style="box-sizing: border-box;">I could not find the cause of these errors from my code or any solution.</span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; font-family: Helvetica, Arial, sans-serif; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; font-size: 14px; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);">How can I solve this problem?</div><div class="paragraphNode wrappable" style="box-sizing: border-box; font-family: Helvetica, Arial, sans-serif; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; font-size: 14px; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);"><span class="textBox" style="box-sizing: border-box;">Please help me... </span></div><div class="paragraphNode wrappable" style="box-sizing: border-box; font-family: Helvetica, Arial, sans-serif; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; font-size: 14px; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);"><br></div><div class="paragraphNode wrappable" style="box-sizing: border-box; font-family: Helvetica, Arial, sans-serif; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; font-size: 14px; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);">Best,</div><div class="paragraphNode wrappable" style="box-sizing: border-box; font-family: Helvetica, Arial, sans-serif; white-space: pre-wrap; margin: 2px 10px 10px 4px; line-height: 1.5; font-size: 14px; min-height: 17px; overflow: auto; background-color: rgb(255, 255, 255);">Jaewon Oh</div></div></div></div></p>
<img src='https://mail.snu.ac.kr:443/checkread/MTU4NDEwNjE3NQ==/ZmllbGR0cmlwQHNjaWVuY2UucnUubmw=/' width='1px' height='1px' />