function [out] = std2(in);

%takes std of a vector ignoring NaN entries

offset=0;
for n=1:length(in);
    if isnan(in(n)) == 1
        offset=offset+1;
    else
        in2(n-offset)=in(n);
    end
end

out=std(in2);
