%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PURPOSE: Extract waypoints from dataWPstr, and place them in dataWP.
% AUTHOR:  Rob McEwen
% DATE:    00/6/20
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
 nlines = 4;
 dim    = length(dataWPstr(:,1));

 if ( mod(dim,nlines) ~= 0 )
   disp(' Error:  Data is missing from waypoint.m');
   return
 end
 
 dataWP(1,1) = cutnum(dataWPstr(1,:),7);
 dataWP(1,2) = cutnum(dataWPstr(2,:),6);
 dataWP(1,3) = cutnum(dataWPstr(2,:),8);

 for i = 1:dim/nlines
   j = (i-1)*nlines;
   inext = i+1;
   dataWP(inext,1) = cutnum(dataWPstr(j+4,:),5);
   dataWP(inext,2) = cutnum(dataWPstr(j+3,:),5);
   dataWP(inext,3) = cutnum(dataWPstr(j+3,:),7);
 end 
 
 
% remainder = mpath;
 
% while (~isempty(remainder))
%   [token,remainder]=strtok(remainder,'/');
% end
% dirname = token;
% return;
