%function do_adcp
 function [f]=do_adcp(nwait,tmr,st,et);
% doit.m - does three steps:
% - scp adcp raw data to local machine
% - run 'runos'
% - run plot_os
%
% - nwait: number of seconds to wait before
% - set timer method 0 - MATLAB 1 - Perl
% - st - date time to start adcp plot (use format '21-July-2005 13:12:56')
% - et - date time to end adcp plot (use 'now' or format similar to
% st above


%fid = fopen('adcp_setup.txt','r');
%[nwait,tmr,st,et] = textread('adcp_setup.txt','%d,%d,%s,%s','headerlines',5,'delimiter',',');

%keyboard

while(1)
  %tic
  t0=clock
  !get_LTA_data

  cd ../adcp/oc415
  !runos
  cd ../../adcp_nb
  plot_os75(st,et)
  
  figure(1)
  drawnow
  
 if nwait < 0
   break
 else
   %tt=toc; % get elapsed time from 'tic'
   tt=etime(clock,t0)
   iwait=nwait*60-tt % iwait is in seconds
   disp(['waiting ',num2str(iwait/60),' minutes ....'])
   %pause(iwait) % wait iwait seconds between plots
   if tmr == 0
     pause(iwait)
   else
     disp(['!wait.pl ', int2str(ceil(iwait))])
     eval(['!wait.pl ', int2str(ceil(iwait))])
   end
 end
end
