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