function [out] = length2(in);
%find the length of the vector, disculding NaN

out = length(find(isnan(in) == 0));