-
Notifications
You must be signed in to change notification settings - Fork 2
/
showPos.m
30 lines (26 loc) · 1003 Bytes
/
showPos.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
function showPos(X,Y, events, filter_laps)
%SHOWPOS this function shows the position of the animal in the running
% section of the maze. If a specific vector of laps in given in
% filter only those laps are shown.
%
% INPUTS:
% X: X position of the animal during all the experiment
% Y: Y position of the animal during all the experiment
% events: Times of starting ending of each lap
% filter_laps: Vector of laps to show in [1 - numLaps]
%
%Ruben Pinzon@2015
figure()
set(gcf,'color','w');
numLaps = length(filter_laps);
color = hsv(numLaps);
% Extract spks when the mouse is running
for l = 1: numLaps
lap = filter_laps(l);
idx_lap = [events{lap}(1,1), events{lap}(end,2)];
X_lap = X(idx_lap(1):idx_lap(2));
Y_lap = Y(idx_lap(1):idx_lap(2));
plot(X_lap, Y_lap, 'color', color(l,:),...
'displayname',sprintf('Lap %d',lap))
hold on
end