Last active
October 4, 2015 20:38
-
-
Save nclack/2695810 to your computer and use it in GitHub Desktop.
Plot the shape of a tracked whisker at a given time point.
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
w = LoadWhiskers('trial.whiskers'); | |
measurements = LoadMeasurements('trial.measurements'); | |
whisker_id=0; % the tracked whisker of interest | |
frame_id=100; % the time point of interest | |
times = [measurements(:).fid]; | |
names = [measurements(:).label]; | |
curveids = [measurements(:).wid]; | |
%% Query the measurements to find curves | |
% that match the whisker id and time of interest | |
mask=(names==whisker_id).*(times==frame_id); | |
t = times(mask); | |
c = curveids(mask); | |
% there should be only one match | |
% but just in case, just take the first one | |
t=t(1); | |
c=c(1); | |
%% Find the corresponding curve in the whisker's data | |
idx=find(([w(:).id]==c).*([w(:).time]==t),1,'first'); | |
plot(w(idx).x,w(idx).y)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment