-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotSpikes.m
More file actions
64 lines (47 loc) · 1.23 KB
/
Copy pathplotSpikes.m
File metadata and controls
64 lines (47 loc) · 1.23 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
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
63
64
function plotSpikes(spikeMatrix, analogChannels, clusterQuality, startTime, endTime)
%figure out time matrix
SAMPLE_RATE=30000;
t=1:length(analogChannels);
startIndex=startTime*SAMPLE_RATE+1;
endIndex=endTime*SAMPLE_RATE;
if startIndex>=length(analogChannels)
startIndex=1;
end
if endIndex>=length(analogChannels)
endIndex=length(analogChannels);
end
figure(1)
clf
binSize=500;
binnedSpikes=binSpikes(spikeMatrix, binSize);
subplot(4,1,1)
binStartIndex=floor(startIndex/binSize)+1;
binEndIndex=floor(endIndex/binSize);
for i=1:length(spikeMatrix(1,:))
%clusterQuality (0=noise, 1=MUA, 2=Single Unit)
if clusterQuality(i)==1
subplot(4,1,1)
plot(binnedSpikes(binStartIndex:binEndIndex,i))
elseif clusterQuality(i)==2
subplot(4,1,2)
plot(binnedSpikes(binStartIndex:binEndIndex,i));
hold on
end
end
subplot(4,1,1)
title('MUA Spikes')
hold off
subplot(4,1,2)
title('Single Units')
hold off
t=t./SAMPLE_RATE;
figure(1)
subplot(4,1,3)
plot(t(startIndex:endIndex), analogChannels(startIndex:endIndex,[2]));
title('Photodiode');
subplot(4,1,4)
plot(t(startIndex:endIndex), analogChannels(startIndex:endIndex,[6]));
xlabel('Time in Seconds');
title('Optogenetics');
hold off
end