-
Notifications
You must be signed in to change notification settings - Fork 2
/
plot_raster.m
47 lines (36 loc) · 949 Bytes
/
plot_raster.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
% plot rasters
%
% This code will go through raster plot for a selected single neuron at
% for each behavioral conditions.
%
% blue: lick right
% red: lick left
%
%
% Ziqiang Wei
load('ephysDataset.mat')
% cell number (ranged from 1 to length of datasets)
cellId = 1;
st_right = ephysDataset(cellId).st_right;
figure;
title(['Raster plot for cell #' num2str(cellId)]);
hold on;
numTrial = 0;
for ntrial = 1:length(st_right)
spkTime = st_right{ntrial};
numTrial = numTrial + 1;
plot(spkTime, numTrial * ones(length(spkTime), 1), '.b');
end
st_left = ephysDataset(cellId).st_left;
for ntrial = 1:length(st_left)
spkTime = st_left{ntrial};
numTrial = numTrial + 1;
plot(spkTime, numTrial * ones(length(spkTime), 1), '.r');
end
gridxy([-2.6 -1.3 0],'Color','k','Linestyle','--') ;
hold on
xlim([-3.0 1.5]);
ylim([0.5 numTrial+0.5]);
xlabel('Time from movement (sec)')
ylabel('Trial index')