forked from restrepd-zz/dropc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdropcStageOne_ac.m
executable file
·62 lines (43 loc) · 1.98 KB
/
dropcStageOne_ac.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function handles = dropcStageOne_ac(handles)
%Begin stage 1: Give mouse water if they lick!
for noReinf=1:20
switch handles.acces
case 0
while (sum(getvalue(handles.dio.Line(25:32)))~=handles.dropcProg.sumNoLick)
end
% sumLickStatus=handles.dropcProg.sumNoLick;
% while (sumLickStatus==handles.dropcProg.sumNoLick)
% %Mouse is not licking
% sumLickStatus=sum(getvalue(handles.dio.Line(25:32)));
% end
fprintf(1, '\nStage 1 Trial No: %d, time: ', noReinf, toc);
handles.dropcData.trialIndex=handles.dropcData.trialIndex+1;
handles.dropcData.trialTime(handles.dropcData.trialIndex)=toc;
dropcReinforceNow(handles);
case 1
%ACCES
%UInt32 DIO_ReadAll(UInt32 DeviceIndex, out UInt32 pData)
data = NET.createArray('System.Byte', 4);
lickOn=0;
while lickOn==0
AIOUSBNet.AIOUSB.DIO_ReadAll(-3, data);
% data(2)
%If you enter 3, you are reading byte 2: relays
%If you enter 1 you are reading PA
%If you enter 2 you read PB
% photodiodeBlocked=bitand(1,data(2));
lickOn=bitand(1,data(2));
end
fprintf(1, '\nStage 1 Trial No: %d, time: %d\n', noReinf, toc);
handles.dropcData.oneTrialTime(handles.dropcData.oneTrialIndex)=toc;
handles.dropcData.oneTrialIndex=handles.dropcData.oneTrialIndex+1;
dropcReinforceNow_ac(handles);
end
iti = (handles.dropcProg.timePerTrial+4)*rand(1);
%if handles.dropcProg.skipIntervals==0
startTime=toc;
while (toc-startTime)<iti
end
%end
% save(handles.dropcProg.output_file,'handles');
end