-
Notifications
You must be signed in to change notification settings - Fork 0
/
LogEvents.m
48 lines (46 loc) · 1.86 KB
/
LogEvents.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
function [Ev, nbev] = LogEvents(Ev, nbev, type, value, ttime, varargin)
global taskTimeStamp
switch type
case 'Picture'
nbev = nbev + 1;
Ev.types(nbev,1) = {'Picture'};
Ev.values(nbev,1) = {value};
Ev.times(nbev,1) = ttime.start;
Ev.exptimes(nbev,1) = ttime.start-taskTimeStamp;
Ev.act_durations(nbev,1) = ttime.end-ttime.start;
if nargin > 5
Ev.int_durations(nbev,1) = varargin{1};
if nargin == 7
Ev.info(nbev,1) = varargin(2);
else
Ev.info(nbev,1) = {[]};
end
else
%Ev.int_durations(nbev,1) = [];
end
case 'Button Press'
if ~isempty(value)
Ev.types(nbev+1:nbev+length(value),1) = {'Button Press'};
% for i=1:length(value)
% if (isnumeric(value{i}) && value{i}==5 )
% Ev.types(nbev+i) = {'Pulse'};
% end
% end
Ev.values(nbev+1:nbev+length(value),1) = value;
Ev.times(nbev+1:nbev+length(value),1) = ttime;
Ev.exptimes(nbev+1:nbev+length(value),1) = ttime-taskTimeStamp;
Ev.act_durations(nbev+1:nbev+length(value),1) = 0;
Ev.int_durations(nbev+1:nbev+length(value),1) = NaN;
Ev.info(nbev+1:nbev+length(value),1) = {[]};
nbev = nbev + length(value);
end
case 'Pulse'
Ev.types(nbev+1:nbev+length(ttime),1) = {'Pulse'};
Ev.values{nbev+1:nbev+length(ttime),1} = 5;
Ev.times(nbev+1:nbev+length(ttime),1) = ttime;
Ev.exptimes(nbev+1:nbev+length(ttime),1) = ttime-taskTimeStamp;
Ev.act_durations(nbev+1:nbev+length(ttime),1) = 0;
Ev.int_durations(nbev+1:nbev+length(ttime),1) = NaN;
Ev.info(nbev+1:nbev+length(ttime),1) = {[]};
nbev = nbev + length(ttime);
end