Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
%GETINNEROUTER determine the number of frames the mouse was in an inner
% zone vs an outer zone of the arena
%
% [NINNERZONE, NOUTERZONE] = GETINNEROUTER(MOUSEPOS, INNERZONE)
%
% MOUSEPOS an Mx2 matrix containing the position of the mouse in all frames
% INNERZONE a four-element vector of the form [x y w h] describing the
% location of the inner zone in mm
%
% Friedrich Kretschmer
% Max-Planck Institute for Brain Research
% sciclist@brain.mpg.de
function [nInnerZone, nOuterZone] = getInnerOuter(mousePos, innerZone)
innerZoneFrames = mousePos(:,1) > innerZone(1) &...
mousePos(:,2) > innerZone(2) &...
mousePos(:,1) < innerZone(1) + innerZone(3) &...
mousePos(:,2) < innerZone(2) + innerZone(4);
outerZoneFrames = ~innerZoneFrames;
nInnerZone = sum(innerZoneFrames);
nOuterZone = sum(outerZoneFrames);
end