-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathedfFindTrialRecordingStart.m
31 lines (28 loc) · 1.04 KB
/
edfFindTrialRecordingStart.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
function [RecordingStartTime]= edfFindTrialRecordingStart(Events, TrialStartMarker)
%% edfImport library v1.0
% Alexander Pastukhov
% kobi.nat.uni-magdeburg.de/edfImport
% email: [email protected]
%
% edfFindTrialRecordingStart
% Returns an absolute time of the recording start ('!MORE RECORD' event) for each trial.
% Note: if Events from more than one trial are passed, only the first one
% is returned
% Syntax:
% [RecordingStartTime]= edfFindTrialRecordingStart(Events)
% Input:
% Events - array of FEVENT structures (see "Eyelink EDF Access API" for details)
% Output:
% RecordingStartTime - absolute time when recording started for each
% trial
%% just in case there is some old that does not explicitely pass the marker
if (~exist('TrialStartMarker', 'var') || isempty(TrialStartMarker))
TrialStartMarker= '!MODE RECORD';
end;
RecordingStartTime= [];
for iE= 1:length(Events.message)
if (~isempty(regexp(Events.message{iE}, TrialStartMarker)))
RecordingStartTime= Events.sttime(iE);
break;
end;
end;