forked from jooh/matlab-studytools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSecondTiming.m
More file actions
33 lines (30 loc) · 1.01 KB
/
Copy pathSecondTiming.m
File metadata and controls
33 lines (30 loc) · 1.01 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
classdef SecondTiming < Timing
% Timing object for running events relative to Psychtoolbox clock
% (ie GetSecs).
methods
function t = SecondTiming(varargin)
t = varargs2structfields(varargin,t);
t.units = 's';
end
function tim = begin(self)
% start the clock
% tim = begin();
[tim, t.first] = deal(GetSecs);
end
function tim = check(self)
% return the current clock time
% tim = check()
self.previous = self.current;
[self.current,tim] = deal(GetSecs);
end
function waituntil(self,abstime)
% wait until an absolute clock time.
% waituntil(abstime)
WaitSecs('UntilTime',abstime);
% it would be nice to use scanner sync to check the TR a bit,
% but unfortunately this method is not stable.
%invoke(self.scanobj,'CheckPulseSynchronyForTime',...
% (abstime-GetSecs)*1e3);
end
end
end