-
Notifications
You must be signed in to change notification settings - Fork 0
/
ge_makeEventList.m
26 lines (22 loc) · 1019 Bytes
/
ge_makeEventList.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
% eventList = ge_makeEventList(EEGVAR, markerChannel)
%
% Function to make an event list matrix out of the marker channel on
% EEG. Specifically set up for EPOC/EPOC+. Note that the marker codes
% are not labelled, just returned. The three columns of the matrix are
% event number (1 to n), event sample point, and event label. The marker
% channel is optional and defaults to the EPOC's channel 20.
%
% MDT
% 2015.07.01
function eventList = ge_makeEventList(EEGVAR, markerChannel)
if nargin < 2
markerChannel = 20; % Default EPOC(+) marker channel
end
nonzeroSamplePoints = find(EEGVAR.data(markerChannel,:));
nonzeroSampleSeconds = nonzeroSamplePoints./128;
nonzeroSampleValues = EEGVAR.data(markerChannel, nonzeroSamplePoints);
n = length(nonzeroSamplePoints);
count = 1:n;
eventList = table(count', nonzeroSamplePoints', nonzeroSampleSeconds', nonzeroSampleValues', ...
'VariableNames',{'Number' 'Sample' 'Time' 'Marker'});
end