function dataOut = penupGaps(dataIn,timeCol,timeDiff)

% If we have multiple start/stop times we'll get jumps in the time stamp
% of the dataIn data. If we plot the Lat/Long we won't do a
% pen-up/pen-down, instead we'll just draw a straight line across the
% time gap. Therefore find gaps and add NaN inbetween them which forces
% a pen-up/pen-down when we plot the data

gaps = find( diff(dataIn(:,timeCol)) > timeDiff);

[rows cols] = size(dataIn);

if(length(gaps) > 0)
  gaps(end+1) = length(dataIn);
  dataOut = dataIn(1:gaps(1),:);
  dataOut(end+1,:) = NaN.*ones(1,cols);
  for z=2:length(gaps)
    start = (length(dataOut) + 1);
    stop  = start + (gaps(z) - gaps(z-1)) - 1;
    stopIn = gaps(z);
    startIn  = (gaps(z-1)+1);
    dataOut( start: stop,: ) = dataIn( startIn:stopIn,:);
    dataOut(end+1,:) = NaN.*ones(1,cols);
  end
else
  dataOut = dataIn;
end


