-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathme_ForLoopScore.m
More file actions
209 lines (198 loc) · 6.52 KB
/
me_ForLoopScore.m
File metadata and controls
209 lines (198 loc) · 6.52 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
%for half between markers compute the alpha imbalance this feeds into
%BlockChop
function AIS = me_ForLoopScore(filename)
% use for meditation analyses
lowerBound = 2;
upperBound = 41;
eegChannels = 1:14;
if regexp(filename,'set$')
EEG2 = pop_loadset(filename);
elseif regexp(filename,'edf$')
EEG2 = pop_biosig(filename);
else
error('ge_handContraction: File type unknown');
end
EEG_only = pop_select(EEG2, 'channel', eegChannels);
EEG_only = pop_eegfilt(EEG_only, lowerBound, upperBound, [], [0], 0, 0, 'fir1', 0);
recordinglength = ceil(size(EEG_only.data));
sessionlength = (recordinglength(2)/128)/60;
a = (1 + min(38399,recordinglength(2)));
b = (min((a+38399),recordinglength(2)));
c = (min((b+38399),recordinglength(2)));
d = (min((c+38399),recordinglength(2)));
e = (min((d+38399),recordinglength(2)));
f = (min((e+38399),recordinglength(2)));
g = (min((f+38399),recordinglength(2)));
h = (min((g+38399),recordinglength(2)));
Timepoints = [a b c d e f g h];
for t = 1:length(Timepoints)
if t == 1
fivemin = EEG_only.data(:,1:Timepoints(t));
blob1.Fs = 128;
blob1.data = fivemin';
tempvar = alphaImbalance(blob1);
AIS{t} = tempvar(3:4);
% tempvar2 = averageAlphaPowerByChannel(blob1);
% AIS{t} = tempvar2(3:4);
% AIS{t} = tempvar2(11:12);
elseif Timepoints(t) > Timepoints(t-1)
fivemin = EEG_only.data(:,1:Timepoints(t));
blob1.Fs = 128;
blob1.data = fivemin';
tempvar = alphaImbalance(blob1);
AIS{t} = tempvar(3:4), Timepoints;
% tempvar2 = averageAlphaPowerByChannel(blob1);
% AIS{t} = tempvar2(3:4);
end
end
% for a = 1:length(Timepoints)
% if a == 1
% fivemin = EEG_only.data(:,1:Timepoints(a));
% blob1.Fs = 128;
% blob1.data = fivemin';
% tempvar = averageAlphaPowerByChannel(blob1);
% AIS{a} = tempvar(3:4);
% elseif Timepoints(a) > Timepoints(a-1)
% fivemin = EEG_only.data(:,1:Timepoints(a));
% blob1.Fs = 128;
% blob1.data = fivemin';
% tempvar = averageAlphaPowerByChannel(blob1);
% AIS{a} = tempvar(3:4);
% end
% end
%
% figure;
% title('798');
% subplot(5,2,1)
%
% % figure;
% bar(AIS{1});
% subplot(5,2,1)
% title('First Five Minutes');
% xlabel('AF3/4, F7/8, F3/4, FC5/6, T7/8, P7/8, O1/2');
% ylabel('Alpha Score');
% hold on
% if ( b > a)
% tenmin = EEG_only.data(:,a:b);
% blob2.Fs = 128;
% blob2.data = tenmin';
% AIS{2} = alphaImbalance(blob2);
% % figure;
% bar(AIS{2});
% subplot(5,2,2)
% title('Second Five Minutes');
% xlabel('AF3/4, F7/8, F3/4, FC5/6, T7/8, P7/8, O1/2');
% ylabel('Alpha Score');
% hold on
% else
% ('file too small, less than 10 minutes');
% end
% if (c > b)
% fifteenmin = EEG_only.data(:,b:c);
% blob3.Fs = 128;
% blob3.data = fifteenmin';
% AIS{3} = alphaImbalance(blob3);
% % figure;
% bar(AIS{3});
% subplot(5,2,3)
% title('Third Five Minutes');
% xlabel('AF3/4, F7/8, F3/4, FC5/6, T7/8, P7/8, O1/2');
% ylabel('Alpha Score');
% hold on
% else
% ('file too small, less than 15 minutes')
% end
% if (d > c)
% twentymin = EEG_only.data(:,c:d);
% blob4.Fs = 128;
% blob4.data = twentymin';
% AIS{4} = alphaImbalance(blob4);
% % figure;
% bar(AIS{4});
% subplot(5,2,4)
% title('Fourth Five Minutes');
% xlabel('AF3/4, F7/8, F3/4, FC5/6, T7/8, P7/8, O1/2');
% ylabel('Alpha Score');
% hold on
% else
% ('file too small, less than 20 minutes')
% end
% if (e > d)
% twentyfivemin = EEG_only.data(:,d:e);
% blob4.Fs = 128;
% blob4.data = twentyfivemin';
% AIS{5} = alphaImbalance(blob4);
% % figure;
% bar(AIS{5});
% subplot(5,2,5)
% title('Fifth Five Minutes');
% xlabel('AF3/4, F7/8, F3/4, FC5/6, T7/8, P7/8, O1/2');
% ylabel('Alpha Score');
% hold on
% else
% ('file too small, less than 25 minutes')
% end
% if (f > e)
% thirtymin = EEG_only.data(:,e:f);
% blob4.Fs = 128;
% blob4.data = thirtymin';
% AIS{6} = alphaImbalance(blob4);
% % figure;
% bar(AIS{6});
% subplot(5,2,6)
% title('Sixth Five Minutes');
% xlabel('AF3/4, F7/8, F3/4, FC5/6, T7/8, P7/8, O1/2');
% ylabel('Alpha Score');
% hold on
% else
%
% ('file too small, less than 30 minutes')
% end
% if (g > f)
% thirtyfivemin = EEG_only.data(:,f:g);
% blob4.Fs = 128;
% blob4.data = thirtyfivemin';
% AIS{7} = alphaImbalance(blob4);
% % figure;
% bar(AIS{7});
% subplot(5,2,7)
% title('Seventh Five Minutes');
% xlabel('AF3/4, F7/8, F3/4, FC5/6, T7/8, P7/8, O1/2');
% ylabel('Alpha Score');
% ylim([-.5 .5])
% % hold on
% else
% ('file too small, less than 35 minutes')
% end
%
% if (h > g)
% fourtymin = EEG_only.data(:,g:h);
% blob4.Fs = 128;
% blob4.data = fourtymin';
% AIS{8} = alphaImbalance(blob4);
% % figure;
% bar(AIS{8});
% subplot(5,2,8)
% title('Eigth Five Minutes');
% xlabel('AF3/4, F7/8, F3/4, FC5/6, T7/8, P7/8, O1/2');
% ylabel('Alpha Score');
% % hold on
% else
% ('file too small, less than 40 minutes')
% end
% if (recordinglength(2) > h)
% fourtyfivemin = EEG_only.data(:,h:recordinglength(2));
% blob4.Fs = 128;
% blob4.data = fourtyfivemin';
% AIS{9} = alphaImbalance(blob4);
% % figure;
% bar(AIS{9});
% subplot(5,2,9)
% title('Ninth Five Minutes');
% xlabel('AF3/4, F7/8, F3/4, FC5/6, T7/8, P7/8, O1/2');
% ylabel('Alpha Score');
% hold on
% else
% ('file too small, less than 45 minutes')
% end
end