-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathERP_Bins_updated.m
61 lines (48 loc) · 2.14 KB
/
ERP_Bins_updated.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
%{
===================================ERP_Bins Script===================================
Summary of function:
This script plots ERP scalp map bins of specified widths for all electrodes.
You need to have a study loaded first.
Written by Vyom
8/24/2018
edited 1/11/2019
%}
%montecarlo with cluster corrections or permutation analysis?
%write 1 for montecarlo or 2 for permutation
statMethod = 1;
%initial and final time points
initial = 0;
final = 1000;
%width of bins
bin = 50;
%ERP limits in microvolts
%if you do not want any limits, simply put lims = [];
lims = [-0.5 0.5];
%save images where?
saveDir = 'C:\Users\vmr160030\Desktop\Test\';
%what dimensions would you like for your images?
width = 650;
height = 650;
%a list of all electrode names
allElecs = {'FP1' 'FPZ' 'FP2' 'AF3' 'AF4' 'F7' 'F5' 'F3' 'F1' 'FZ' 'F2' 'F4' 'F6' 'F8' 'FT7' 'FC5' 'FC3' 'FC1' 'FCZ' 'FC2' 'FC4' 'FC6' 'FT8' 'T7' 'C5' 'C3' 'C1' 'CZ' 'C2' 'C4' 'C6' 'T8' 'TP7' 'CP5' 'CP3' 'CP1' 'CPZ' 'CP2' 'CP4' 'CP6' 'TP8' 'P7' 'P5' 'P3' 'P1' 'PZ' 'P2' 'P4' 'P6' 'P8' 'PO7' 'PO5' 'PO3' 'POZ' 'PO4' 'PO6' 'PO8' 'CB1' 'O1' 'OZ' 'O2' 'CB2'};
i = initial;
while i < final
STUDY = pop_statparams(STUDY, 'groupstats','on','condstats','on','naccu',1000,'method','perm','alpha',0.05);
if (statMethod == 2)
STUDY = pop_statparams(STUDY, 'groupstats','on','condstats','on','naccu',1000,'method','perm','alpha',0.05);
stat = 'permutation';
elseif (statMethod == 1)
STUDY = pop_statparams(STUDY, 'groupstats','off','mode','fieldtrip','fieldtripnaccu',1000,'fieldtripmethod','montecarlo','fieldtripmcorrect','cluster','fieldtripalpha',0.05);
stat = 'monteCarlo';
end
STUDY = pop_erpparams(STUDY, 'plotgroups','together','plotconditions','together','topotime',[i i+bin],'averagechan','off','ylim',lims );
STUDY = std_erpplot(STUDY,ALLEEG,'channels',allElecs);
savePath = strcat(saveDir,'\ERP scalp ',num2str(i),'-',num2str(i + bin),' ms_',stat,'.jpeg');
fig1 = gcf;
fig1.PaperUnits = 'points';
fig1.PaperPosition = [0 0 width height];
saveas(fig1,savePath);
close(gcf);
i = i + 50;
end
disp('50ms bins is done running');