% have different setting for different recording room
% edited on 04/25/2016
while 1
    [~, timeStampArray, locationArray, ~, VTRecsReturned, ~] = NlxGetNewVTData(vt_acq_ent);
    if ~isempty(timeStampArray)
        break
    end
    pause(sample_time);
end
time0=timeStampArray(end);
x_loc = locationArray(end - 1);
y_loc = locationArray(end);
if ~x_loc && ~y_loc %% if x_loc=0, y_loc=0 means it's a missing data from the video
    x_loc=locationArray_end(1);
    y_loc=locationArray_end(2);
end
if ~x_loc && ~y_loc %% if still x_loc=0, y_loc=0
    x0=0;
    y0=0;
    dist0=0;
    ang0=0;
else
    x0 = x_sign*double(x_loc).*scale_x-x_center;
    y0 = y_sign*double(y_loc).*scale_y-y_center;
    dist0=sqrt(x0^2+y0^2);
    if x0>=0
        if x0==0 x0=0.01; end
        ang0=mod(atan(-y0/x0),2*pi);
    else
        ang0=mod(atan(-y0/x0)+pi,2*pi);
    end
    if strcmp(rot,'Counterclockwise');
        ang0=2*pi-ang0;
    end
end
locationArray_end=[x_loc,y_loc];