Commit 423264a6 authored by Amit Goldenberg's avatar Amit Goldenberg

added files from Daniel's computer

parent 095d54bd
This diff is collapsed.
FidNz 0 9.071585155 -2.359754454
FidT9 -6.711765 0.040402876 -3.251600355
FidT10 6.711765 0.040402876 -3.251600355
Fp1 -2.695405558 8.884820317 1.088308144
Fp2 2.695405558 8.884820317 1.088308144
F3 -4.459387187 6.021159964 4.365321482
F4 4.459387187 6.021159964 4.365321482
C3 -5.47913021 0.284948655 6.38332782
C4 5.47913021 0.284948655 6.38332782
P3 -5.831241498 -4.494821698 4.955347697
P4 5.831241498 -4.494821698 4.955347697
O1 -2.738838019 -8.607966849 0.239368223
O2 2.738838019 -8.607966849 0.239368223
F7 -6.399087198 4.127248875 -0.356852241
F8 6.399087198 4.127248875 -0.356852241
T3 -7.304625099 -1.866238006 -0.629182006
T4 7.304625099 -1.866238006 -0.629182006
T5 -6.034746843 -5.755782196 0.051843011
T6 6.034746843 -5.755782196 0.051843011
Fz 0 7.96264703 5.044718001
Cz 0 9.271139705 -2.211516434
Pz 0 -6.676694032 6.465208258
Oz 0 -8.996686498 0.487952047
E21 -6.518995129 2.417299399 -5.253637073
E22 6.518995129 2.417299399 -5.253637073
LM -6.174969392 -2.458138877 -5.637380998
RM 6.174969392 -2.458138877 -5.637380998
E25 -3.784983913 -6.401014415 -5.260040689
E26 3.784983913 -6.401014415 -5.260040689
E27 0 9.087440894 1.333345013
FCz 0 3.806770224 7.891304964
LE -3.743504949 6.649204911 -6.530243068
RE 3.743504949 6.649204911 -6.530243068
E31 -6.118458137 4.523870113 -4.409174427
E32 6.118458137 4.523870113 -4.409174427
Cz 0 0 8.899186843
Fp1 E1 -2.695405558 8.884820317 1.088308144
Fp2 E2 2.695405558 8.884820317 1.088308144
F3 E3 -4.459387187 6.021159964 4.365321482
F4 E4 4.459387187 6.021159964 4.365321482
C3 E5 -5.47913021 0.284948655 6.38332782
C4 E6 5.47913021 0.284948655 6.38332782
P3 E7 -5.831241498 -4.494821698 4.955347697
P4 E8 5.831241498 -4.494821698 4.955347697
O1 E9 -2.738838019 -8.607966849 0.239368223
O2 E10 2.738838019 -8.607966849 0.239368223
F7 E11 -6.399087198 4.127248875 -0.356852241
F8 E12 6.399087198 4.127248875 -0.356852241
T3 E13 -7.304625099 -1.866238006 -0.629182006
T4 E14 7.304625099 -1.866238006 -0.629182006
T5 E15 -6.034746843 -5.755782196 0.051843011
T6 E16 6.034746843 -5.755782196 0.051843011
Fz E17 0 7.96264703 5.044718001
Cz E18 0 0 8.899186843
Pz E19 0 -6.676694032 6.465208258
Oz E20 0 -8.996686498 0.487952047
F9 E21 -6.518995129 2.417299399 -5.253637073
F10 E22 6.518995129 2.417299399 -5.253637073
LM E23 -6.174969392 -2.458138877 -5.637380998
RM E24 6.174969392 -2.458138877 -5.637380998
O9 E25 -3.784983913 -6.401014415 -5.260040689
O10 E26 3.784983913 -6.401014415 -5.260040689
Fpz E27 0 9.087440894 1.333345013
FCz E28 0 3.806770224 7.891304964
VEOG1 LE -3.743504949 6.649204911 -6.530243068
VEOG2 RE 3.743504949 6.649204911 -6.530243068
HEOG1 E31 -6.118458137 4.523870113 -4.409174427
HEOG2 E32 6.118458137 4.523870113 -4.409174427
function epoch = epochList(EEG)
epoch = struct(); % genereerib trialitestruktuuri, kus oleks vaid ks vrtus triali kohta
epoch = struct(); % genereerib trialitestruktuuri, kus oleks vaid ks vrtus triali kohta
for e = 1:EEG.trials
fld = fields(EEG.epoch)';
for f = 2:length(fld)
if iscell(EEG.epoch(e).(fld{f})) % kui on hes trialis mitu eventi
EEG.epoch(e).(fld{f}) = EEG.epoch(e).(fld{f}){end};
if iscell(EEG.epoch(e).(fld{f})) % kui on hes trialis mitu eventi
EEG.epoch(e).(fld{f}) = EEG.epoch(e).(fld{f}){1};
end
if ischar(EEG.epoch(e).(fld{f}))
epoch(e).(fld{f}(6:end)) = strtrim(EEG.epoch(e).(fld{f})); % kui on string, eemalda thikud
epoch(e).(fld{f}(6:end)) = strtrim(EEG.epoch(e).(fld{f})); % kui on string, eemalda thikud
else
% epoch(e).(fld{f}(6:end)) = EEG.epoch(e).(fld{f});
epoch(e).(fld{f}(6:end)) = num2str(EEG.epoch(e).(fld{f}));
......
......@@ -121,7 +121,7 @@ function outf = exportERPeffect(savefile, inp, design, comp, baseline, loc, late
for d = 1:numel(data) % loop through experimental conditions
for locType = {'roi', 'ch'} % loop through making ROI ja single channel output
for locType = {'roi', 'ch'} % loop through making ROI and single channel output
if ~strcmp(loc,locType{:}) && ~strcmp(loc,'both') % if the selected locType will not be exported
continue
......@@ -141,7 +141,9 @@ function outf = exportERPeffect(savefile, inp, design, comp, baseline, loc, late
end
if strcmp(singletrial,'yes')
outf.([locType{:} '_singletrial_amp']) = [{'subject' 'component'} flds' inp.epochFields {'data'}];
outf.([locType{:} '_singletrial_amp']) = [{'subject' 'component'} flds' 'channel' inp.epochFields {'data'}];
outf.([locType{:} '_singletrial_amp_splithalf']) = {'subject' 'cond' 'odd' 'even'};
outf.([locType{:} '_singletrial_amp_SNR']) = {'subject' 'cond' 'Mean' 'SD'};
end
end
......@@ -150,16 +152,16 @@ function outf = exportERPeffect(savefile, inp, design, comp, baseline, loc, late
if strcmp(locType,'roi')
fieldName = [comp{c,1} '_' vars{d}];
dataCall = ['data{' inds{d} '}(chind,ltind:utind,:)'];
chSel = 'chind';
if ch~=chind(1) % when making ROI output loop only a single round
continue
end
elseif strcmp(locType,'ch')
fieldName = [comp{c,1} '_' vars{d} '_' inp.chanlocs(ch).labels];
dataCall = ['data{' inds{d} '}(ch,ltind:utind,:)'];
end
chSel = 'ch';
end
dataCall = ['data{' inds{d} '}(' chSel ',ltind:utind,:)'];
% AMPLITUDE %
outf.([locType{:} '_amp'])(:,end+1) = cat(1,fieldName,...
mat2cell(squeeze(mean(mean(eval(dataCall),2),1)),ones(size(data{1},3),1),1));
......@@ -171,10 +173,13 @@ function outf = exportERPeffect(savefile, inp, design, comp, baseline, loc, late
bkgcol = eval(['inp.raw.inf{' strcat(inds{d},',',num2str(s)) '}']);
infocol = [inp.subs(s) strsplit(fieldName,'_')];
outf.([locType{:} '_singletrial_amp'])(end+1:end+length(datcol),:) = cat(2,repmat(infocol,[length(datcol),1]),bkgcol,mat2cell(datcol,ones(size(datcol)),1));
end
% RELIABILTY
outf.([locType{:} '_singletrial_amp_splithalf'])(end+1,:) = {infocol{1} fieldName mean(datcol(1:2:end)) mean(datcol(2:2:end))};
outf.([locType{:} '_singletrial_amp_SNR'])(end+1,:) = {infocol{1} fieldName mean(datcol) std(datcol)};
end
end
% LATENCY %
if any(strcmp(latency,{'pl', 'both'}))
......@@ -275,14 +280,14 @@ function outf = exportERPeffect(savefile, inp, design, comp, baseline, loc, late
outf.(f{:}) = cat(2,[{'subject'} inp.subs]',outf.(f{:}));
end
xlswrite(savefile,outf.(f{:}),[comp{c,1} f{:}])
if isempty(allout)
allout = outf.(f{:});
else
allout = cat(2,allout,outf.(f{:})(:,2:end));
end
% if isempty(allout)
% allout = outf.(f{:});
% else
% allout = cat(2,allout,outf.(f{:})(:,2:end));
% end
end
end
xlswrite(savefile,allout,'allout');
% xlswrite(savefile,allout,'allout');
end
\ No newline at end of file
......@@ -18,20 +18,20 @@ function bkg = getBkg(EEG, des, bkg, subRemove, chanlocs)
[a, a] = setdiff({chanlocs.labels}, {EEG.chanlocs.labels});
bkg(end,a+1) = {NaN}; % kustutab puuduvad
epoch = EEG.event(1); for e = 1:length(EEG.epoch); epoch(e) = EEG.event(EEG.epoch(e).event(end)); end
epoch = EEG.event(1); for e = 1:length(EEG.epoch); epoch(e) = EEG.event(EEG.epoch(e).event(1)); end
lbls = {}; max = [];
vars = {}; inds = {}; % make a list of concatenated labels and indices using the "odometer" method
factors = fields(des)';
for f = 1:length(factors)
levels = des.(factors{f});
for l = 1:length(levels);
lbls{f,l} = levels{l};
for f = 1:length(factors) % loop throough factors
levels = des.(factors{f});
for l = 1:length(levels); % loop through levels of the given factor
lbls{f,l} = levels{l}; % populate a cell of level labels
end
max(f) = l;
for e = 1:length(epoch) % if happens to be numeric, convert to text
for e = 1:length(epoch) % if levels happen to be numeric, convert to text
epoch(e).(factors{f}) = num2str(epoch(e).(factors{f}));
end
......@@ -39,14 +39,18 @@ function bkg = getBkg(EEG, des, bkg, subRemove, chanlocs)
at = ones(1,size(lbls,1)); % min and max levels (the former will cycle)
while length(vars) < prod(max); % repeat until all possible levels have been found
while length(vars) < prod(max); % repeat until all possible levels have been found
row.L = ''; row.D = 1; % initiate row counters
for i = 1:length(at) % cycle through all avaailable variables
row.L = [row.L '_' lbls{i,at(i)}]; % generate a label for the taken variable and level
row.L = [row.L '_' lbls{i,at(i)}]; % generate a label for the given variable and level
row.D = row.D.*strcmp(lbls{i,at(i)},{epoch.(factors{i})}); % generate indices for the given variable and level
end
vars{end+1} = row.L(2:end); % add the generated rows to the growing lists
inds{end+1} = sum(row.D);
% add psychometrics here
% split-half reliability
at(end) = at(end) + 1; % shift the last ring on the odometer
for i = length(at):-1:1 % cycle through all variables
if at(i) > max(i); % if any of them has reached their limit, reset this one and shift the previous one to next level
......
Number labels Y X Z sph_theta sph_phi sph_radius theta radius type
1 Fp1 2.7 8.88 1.09 16.9 6.69 9.35 -16.9 0.463
2 Fp2 -2.7 8.88 1.09 -16.9 6.69 9.35 16.9 0.463
3 F3 4.46 6.02 4.37 36.5 30.2 8.67 -36.5 0.332
4 F4 -4.46 6.02 4.37 -36.5 30.2 8.67 36.5 0.332
5 C3 5.48 0.285 6.38 87 49.3 8.42 -87 0.226
6 C4 -5.48 0.285 6.38 -87 49.3 8.42 87 0.226
7 P3 5.83 -4.49 4.96 128 33.9 8.87 -128 0.311
8 P4 -5.83 -4.49 4.96 -128 33.9 8.87 128 0.311
9 O1 2.74 -8.61 0.239 162 1.52 9.04 -162 0.492
10 O2 -2.74 -8.61 0.239 -162 1.52 9.04 162 0.492
11 F7 6.4 4.13 -0.357 57.2 -2.68 7.62 -57.2 0.515
12 F8 -6.4 4.13 -0.357 -57.2 -2.68 7.62 57.2 0.515
13 T3 7.3 -1.87 -0.629 104 -4.77 7.57 -104 0.527
14 T4 -7.3 -1.87 -0.629 -104 -4.77 7.57 104 0.527
15 T5 6.03 -5.76 0.0518 134 0.356 8.34 -134 0.498
16 T6 -6.03 -5.76 0.0518 -134 0.356 8.34 134 0.498
17 Fz -0 7.96 5.04 -0 32.4 9.43 0 0.32
18 Cz -0 9.27 -2.21 -0 -13.4 9.53 0 0.575
19 Pz -8.18e-16 -6.68 6.47 -180 44.1 9.29 180 0.255
20 Oz -1.1e-15 -9 0.488 -180 3.1 9.01 180 0.483
21 21 6.52 2.42 -5.25 69.7 -37.1 8.71 -69.7 0.706
22 22 -6.52 2.42 -5.25 -69.7 -37.1 8.71 69.7 0.706
23 25 3.78 -6.4 -5.26 149 -35.3 9.11 -149 0.696
24 26 -3.78 -6.4 -5.26 -149 -35.3 9.11 149 0.696
25 27 -0 9.09 1.33 -0 8.35 9.18 0 0.454
26 FCz -0 3.81 7.89 -0 64.2 8.76 0 0.143
27 EOG1 3.74 6.65 -6.53 29.4 -40.6 10 -29.4 0.725
28 EOG2 -3.74 6.65 -6.53 -29.4 -40.6 10 29.4 0.725
29 EOG3 6.12 4.52 -4.41 53.5 -30.1 8.79 -53.5 0.667
30 EOG4 -6.12 4.52 -4.41 -53.5 -30.1 8.79 53.5 0.667
Number labels theta radius X Y Z sph_theta sph_phi sph_radius type
1 Fp1 -16.9 0.463 8.88 2.7 1.09 16.9 6.69 9.35
2 Fp2 16.9 0.463 8.88 -2.7 1.09 -16.9 6.69 9.35
3 F3 -36.5 0.332 6.02 4.46 4.37 36.5 30.2 8.67
4 F4 36.5 0.332 6.02 -4.46 4.37 -36.5 30.2 8.67
5 C3 -87 0.226 0.285 5.48 6.38 87 49.3 8.42
6 C4 87 0.226 0.285 -5.48 6.38 -87 49.3 8.42
7 P3 -128 0.311 -4.49 5.83 4.96 128 33.9 8.87
8 P4 128 0.311 -4.49 -5.83 4.96 -128 33.9 8.87
9 O1 -162 0.492 -8.61 2.74 0.239 162 1.52 9.04
10 O2 162 0.492 -8.61 -2.74 0.239 -162 1.52 9.04
11 F7 -57.2 0.515 4.13 6.4 -0.357 57.2 -2.68 7.62
12 F8 57.2 0.515 4.13 -6.4 -0.357 -57.2 -2.68 7.62
13 T3 -104 0.527 -1.87 7.3 -0.629 104 -4.77 7.57
14 T4 104 0.527 -1.87 -7.3 -0.629 -104 -4.77 7.57
15 T5 -134 0.498 -5.76 6.03 0.0518 134 0.356 8.34
16 T6 134 0.498 -5.76 -6.03 0.0518 -134 0.356 8.34
17 Fz 0 0.32 7.96 0 5.04 0 32.4 9.43
18 Fn 0 0.575 9.27 0 -2.21 0 -13.4 9.53
19 Pz 180 0.255 -6.68 -8.18E-16 6.47 -180 44.1 9.29
20 Oz 180 0.483 -9 -1.10E-15 0.488 -180 3.1 9.01
21 F9 -69.7 0.706 2.42 6.52 -5.25 69.7 -37.1 8.71
22 F10 69.7 0.706 2.42 -6.52 -5.25 -69.7 -37.1 8.71
23 O9 -149 0.696 -6.4 3.78 -5.26 149 -35.3 9.11
24 O10 149 0.696 -6.4 -3.78 -5.26 -149 -35.3 9.11
25 Fpz 0 0.454 9.09 0 1.33 0 8.35 9.18
26 FCz 0 0.143 3.81 0 7.89 0 64.2 8.76
27 VEOG1 -29.4 0.725 6.65 3.74 -6.53 29.4 -40.6 10
28 VEOG2 29.4 0.725 6.65 -3.74 -6.53 -29.4 -40.6 10
29 HEOG1 -53.5 0.667 4.52 6.12 -4.41 53.5 -30.1 8.79
30 HEOG2 53.5 0.667 4.52 -6.12 -4.41 -53.5 -30.1 8.79
31 Cz 0 0 5.45E-16 0 8.9 0 90 8.9
......@@ -100,7 +100,7 @@ function plotERPeffect(plot, dim2plot, design, pval, correct, timewindow, baseli
loc.roi = []; loc.ch = [];
for c = 1:length(plot.chanlocs)
if length(plot.chanlocs(c).labels) > 3 % leiab ROId nende sildi pikkuse alusel
loc.roi = [loc.roi c];
% loc.roi = [loc.roi c];
else
loc.ch = [loc.ch c];
end
......@@ -109,10 +109,11 @@ function plotERPeffect(plot, dim2plot, design, pval, correct, timewindow, baseli
if strcmp(correct,'cluster')
% MAKE FIELDTRIP ELECTRODE LAYOUT AND NEIGHBOURS STRUCTURE
a = struct();
a.elec.pnt = [plot.chanlocs.X; plot.chanlocs.Y; plot.chanlocs.Z]';
[a.elec.label, a.label] = deal({plot.chanlocs.labels});
layout = ft_prepare_layout(a);
neighbours = ft_prepare_neighbours(struct('method', {'distance'}, 'neighbourdist', {60}, 'layout', {layout}, 'channel', {a.label}, 'elec', {a.elec}, 'feedback', {'no'}));
neighbours = ft_prepare_neighbours(struct('method', {'distance'}, 'neighbourdist', {8}, 'layout', {layout}, 'channel', {a.label}, 'elec', {a.elec}, 'feedback', {'no'}));
labels = fields(plot.labels);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment