-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcuspisDemo.m
38 lines (32 loc) · 889 Bytes
/
cuspisDemo.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
function [D, signal] = cuspisDemo(demoNo)
arguments
demoNo(1,1) {mustBeInteger, mustBeMember(demoNo, [1, 2])};
end
%%
if demoNo == 1
nPres = 1;
else
nPres = 3;
end
Bhapi = setApi();
MpSys = setDaq();
openApi(Bhapi, MpSys);
ecg = recSignal(Bhapi, MpSys, 6, 'seconds', 0.5);
thresh = getEcgThresh(ecg, MpSys, 0.6, 97, 0);
commandwindow();
Screen('Preference', 'SkipSyncTests', 1);
PsychDefaultSetup(2);
HideCursor();
screenNo = max(Screen('Screens'));
windowPtr = Screen('OpenWindow', screenNo, [150 150 150]);
Screen('BlendFunction', windowPtr, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
%% PREPARE STIMULUS
Stim = prepStim(fullfile(pwd(), 'circle.jpg'), windowPtr, 0.100, 0.300, nPres);
%% TRIGGER TRIAL
[D, signal] = triggerTrial(Stim, thresh, 6, Bhapi, MpSys, 0.05);
%%
closeApi(Bhapi, MpSys);
WaitSecs(0.5);
ShowCursor();
sca;
end