-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathernProcessing.m
More file actions
96 lines (73 loc) · 2.02 KB
/
ernProcessing.m
File metadata and controls
96 lines (73 loc) · 2.02 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
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);
eventCodes=[3, 4];
[ernCorIndexPnts,corErnTimes,~,~,corErnRts]=soarEventFinder(EEG,eventCodes,lern);
eventCodes=[10, 11];
[ernIncIndexPnts,incErnTimes,~,~,incErnRts]=soarEventFinder(EEG,eventCodes,lern);
totalErnEvents=length(ernIncIndexPnts)+length(ernCorIndexPnts);
totalErnAccuracy=length(ernCorIndexPnts)./totalErnEvents;
eventCodes=[3, 4, 10, 11];
winLength=1;
[epochCells,meanCells,indexPnts,sTimes,ernCodes,ernTimeStamps,ernRts]=soarEventEpochs(EEG,eventCodes,lern,winLength);
meanEeg=mean(meanCells);
xPnts=linspace(0,1,length(meanEeg));
figure();
plot(xPnts,meanEeg*1000)
ylabel('Voltage (mV)')
xlabel('Time (s)')
% endPoint=min([samples,sTimes(end)])
% find the doors arrow stim
% find the flanker response code