% 01/14/2015
% track the center of the track
% let the headstage go around the track

% beep at the beginning of the tracking
fs_sin=8000;
fs0=800;
t=0 : 1/fs_sin : 0.1;
beep0 = sin(fs0*2*pi*t);

fprintf('Start tracking: ');
pause(20);
% drop the old data
[~, ~, locationArray, ~, VTRecsReturned, ~] = NlxGetNewVTData(vt_acq_ent);
sound(beep0,fs_sin);
pause(20);
[~, ~, locationArray, ~, VTRecsReturned, ~] = NlxGetNewVTData(vt_acq_ent);
sound(beep0,fs_sin);

x_circle=double(locationArray(1:2:end-1))*scale_x;
y_circle=(-1)*double(locationArray(2:2:end))*scale_y;

x_center=(max(x_circle)+min(x_circle))/2;
y_center=(max(y_circle)+min(y_circle))/2;

fprintf('center: %s , %s, \r',num2str(x_center),num2str(y_center));