%
% 3 Mar 2016 RSM
% 
  lstr={};
  if exist( 'idtTFigPtr' ) ~= 1
    idtTFigPtr= figure;
    set( idtTFigPtr, 'Name', 'DeltaT Timing', 'DeleteFcn', 'clear idtTFigPtr' );
    set(gcf,'position',position)
    idtTFontsize=20;
    idtTFontweight='normal';
    set(gca,'fontsize',idtTFontsize,'fontweigh',idtTFontweight)
    set(gcf,'defaultaxesfontsize',idtTFontsize,'defaulttextfontsize', ...
	    idtTFontsize)
  else
    figure(idtTFigPtr);
  end
  itdTSubPtr(1) = subplot(2,1,1);
  idtTPltPtr(1) = plot(idt.data(1:end-1,1), diff(idt.data(:,1))*1000,'b');
  grid on
  hold on
  idtTPltPtr(2) = plot(idt_fwd.data(1:end-1,1), diff(idt_fwd.data(:,1))*1000, 'r');
  title(['MVC Time Stamp Differences    ', titleStr]);
  ylabel('Milliseconds');


  itdTSubPtr(2) = subplot(2,1,2);
  idtTPltPtr(3) = plot(idt.data(:,1), idt.data(:,idt.DataLatency),'b');
  lstr(length(lstr)+1,1) = {'Side Data Latency'};
  grid on
  hold on
  idtTPltPtr(4) = plot(idt_fwd.data(:,1), idt_fwd.data(:,idt_fwd.DataLatency),'r');
  lstr(length(lstr)+1,1) = {'Forward Data Latency'};

  kftSideInterp = interp1(dataK(:,end), dataK(:,triggerTime), idt.data(:,end));  
  kftFwdInterp  = interp1(dataK(:,end), dataK(:,triggerTime), idt_fwd.data(:,end));  
  
  idtTPltPtr(5) = plot(idt.data(:,1), (idt.data(:,end)-kftSideInterp)*1000,'--b');
  % idtTPltPtr(5) = plot(idt.data(:,1), ...
  %      (idt.data(:,idt.InterrogationTime) + ...
  % 	idt.data(:,idt.DataLatency)-kftSideInterp)*1000,'--b');
   % idtTPltPtr(5) = plot(idt.data(:,1), ...
   % 		   (kftSideInterp)-idt.data(:,idt.InterrogationTime),'--b');
  lstr(length(lstr)+1,1) = {'Side Trigger Delay'};
  
  idtTPltPtr(6) = plot(idt_fwd.data(:,1), (idt_fwd.data(:,end)-kftFwdInterp)*1000,'--r');
  % idtTPltPtr(6) = plot(idt_fwd.data(:,1), ...
  %      (kftFwdInterp)-idt_fwd.data(:,idt_fwd.InterrogationTime),'--r');
  lstr(length(lstr)+1,1) = {'Fwd Trigger Delay'};
  
  xlabel('Seconds');
  title('Beamformer Data Latency ');
  ylabel('Milliseconds');

  legend(lstr, 'location','best')

  linkaxes(get(gcf,'children'),'x')
