function [data,units] = compute_dlength_inmost_wing(trx,n)

flies = trx.exp2flies{n};
nflies = numel(flies);
data = cell(1,nflies);
for i = 1:nflies,
  fly = flies(i);

  dlengthl = diff(trx(fly).wing_lengthl_mm,1,2);
  dlengthr = diff(trx(fly).wing_lengthr_mm,1,2);
  data{i} = dlengthl;
  idx = trx(fly).wing_angler(1:end-1) <= -trx(fly).wing_anglel(1:end-1);
  data{i}(idx) = dlengthr(idx);
  
  data{i} = data{i} ./ trx(fly).dt;  
end
units = parseunits('mm/s');


kristinbranson
github-repos/MATLAB/kristinbranson-JAABA/JAABA-5d778a23e3e7cf272df9a89a72b1b66d94f535d7/perframe/compute_perframe_features/compute_dlength_inmost_wing.m
JAABA
github-repos/MATLAB/kristinbranson-JAABA
5d778a23e3e7cf272df9a89a72b1b66d94f535d7