-
Notifications
You must be signed in to change notification settings - Fork 1
/
soarProcessing.m
120 lines (95 loc) · 2.34 KB
/
soarProcessing.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
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
clear;
clc;
tic;
bnds=[.1,40];
winLen=1;
chanPercent=[];
fName='OSU-00001-04B-01-ERN.bdf';
subst='.bdf';
outEx='.mat';
dirName = 'C:\Users\John\Documents\MATLAB\soarData\';
[sub] = subdir(dirName);
metaData=struct2table(sub);
fileList=metaData.name;
ii=fileList(1);
for ij=1:length(fileList)
ij/length(fileList);
ii=fileList(ij);
fName=ii{1};
tf = endsWith(fName,subst);
if tf ~= (0)
try
outName=append(fName,outEx);
outName
%load(outName,'EEG')
%EEG = eeg_checkset(EEG); clc;
catch
chanPer=1;
end
end
%chanPercent=[chanPercent; chanPer];
%save('soarSnrResample5.mat','chanPercent');
end
%finalMean=mean(chanPercent);
%truPer=chanPercent(find(chanPercent~=1));
%trueMean=mean(truPer);
% Flanker/ERN Task:
% ERROR TRIALS = 9 and 10
% CORRECT TRIALS = 3 and 4
%
% LST/Doors Task:
% WIN TRIAL = 7
% LOSS TRIAL = 6
toc;
load('OSU-00002-04B-01-ERN.bdf.mat')
% lst and ern
%npu load
f2='OSU_00001_01_01-ERN.log';
ern = readtable(f2,'NumHeaderLines',5,ReadRowNames=true);
f3='OSU_00001_01_01-LST.log';
lst = readtable(f3,'NumHeaderLines',5,ReadRowNames=true);
f4='OSU_00001_01_01-NPU.log';
npu = readtable(f4,'NumHeaderLines',7,ReadRowNames=true);
lern=table2cell(ern);
llst=table2cell(lst);
lnpu=table2cell(npu);
winLength=.5;
preLength=.5;
[totalErnAccuracy,corErnRts,incErnRts,meanEeg,meanErnEeg,meanCrnEeg,ernEpochCells,crnEpochCells,xPnts]=ernProcess(EEG,lern,preLength,winLength);
% plot figures
figure();
plot(xPnts,meanEeg)
ylabel('Voltage (uV)')
xlabel('Time (s)')
% endPoint=min([samples,sTimes(end)])
% find the doors arrow stim
% find the flanker response code
xPnts=linspace(0,round(winLength*EEG.srate),length(meanErnEeg));
plot(xPnts,meanErnEeg)
ylabel('Voltage (uV)')
xlabel('Time (ms)')
hold on;
plot(xPnts,meanCrnEeg)
legend('Error','Correct')
hold off;
xx=EEG.chanlocs;
splName='STUDY_headplot.spl';
xx = readlocs('Standard-10-10-Cap47.ced');
headplot('setup', xx, splName)
figure;
%headplot(EEG.data, splName)
headplot(crnMeanCells, splName)
%% lst
clc;
clear EEG;
load('OSU-00002-04B-01-LST.bdf.mat')
winLength=1;
[meanWinCells,meanLosCells,lstWin,lstLos,xPnts]=lstProcess(EEG,llst,winLength);
figure();
plot(xPnts,lstWin)
ylabel('Voltage (uV)')
xlabel('Time (s)')
hold on;
plot(xPnts,lstLos)
legend('Win','Loss')
hold off;