-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakenewvisstimsignal.m
61 lines (44 loc) · 1.34 KB
/
makenewvisstimsignal.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
function New_signal_ds = makenewvisstimsignal(data, AbsoluteTrialStartTime,startTime)
%%data is full size nidaq
if nargin<3, startTime=1
end
clearvars -except data AbsoluteTrialStartTime startTime
fulllength= zeros(1,length(data(:,1))+10000);
for i=1:length(AbsoluteTrialStartTime(:,6))
Hourtime(i) = AbsoluteTrialStartTime(i,4)*60*60;
Minutetime(i) = AbsoluteTrialStartTime(i,5)*60;
Secondtime(i) = AbsoluteTrialStartTime(i,6);
Abstime(i) = Hourtime(i) + Minutetime(i) + Secondtime(i);
end
Abstimenew = round((Abstime - min(Abstime)) *1000) + 4000; %% put nothing in 1st 4 s
fulllength(Abstimenew) = 5;
blankTime=4001;
for j=blankTime:1:length(fulllength); %%%
if sum(fulllength(j-3600:j))>1 %%%% 3600
New_signal(j) = 5;
else
New_signal(j) = fulllength(j);
end
end
twopframes = find(diff(data(:,2))>1);
New_signal_ds = New_signal(twopframes);
aa=find(diff(New_signal_ds)>1);
length(aa)
%
% temp=zeros(1,startTime)
% temp2=[temp New_signal_ds temp]
% temp3=temp2
%
% C = find(diff(frames2p)==3);
% C=C+1; % adjusts to be index of actual pulse instead of shifted by 1 bc of diff
% C=C(1:nframes);
% %
% % temp=zeros(1,123)
% % temp2=[temp New_signal_ds]
% % temp3=temp2(1:14000)
% %
% % figure
% % plot(temp3)
% % hold on
% % plot(T03_210204_002visstim)
end