This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
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?
OpenFieldAnalysis/getInnerOuter.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24 lines (21 sloc)
857 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%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 |