function data=transect(in_file)

% Imports data contained in filename, in_file and idenitifies individual 
% transects based on a maximum distance between points in any tansect.
% This maximum distance is defined as 0.005 degrees but can be changed by
% user.

%% Import data from in_file

data = importdata(in_file);
[A ~]=size(data);
if A>1
   
%% define maximum distance between transect points
dist_max=0.005;

%% Calculate distance between each point and the next point
for i=1:A-1
    dist=sqrt((data(i,1)-data(i+1,1))^2+((data(i,2)-data(i+1,2))^2));
    data(i,7)=dist;
end
data(A,7)=0;

%% Identify transects using maximum distance
ind=1;
data(1,8)=ind;

for i=2:A-1
  
   if data(i,7)<dist_max   
   data(i,8)=ind;
    else
        data(i,8)=ind;
        ind=ind+1;
    end
end
%%
 if (data(A-1,7)<dist_max)
     data(A,8)=ind;
 else
    data(A,8)=data(A-1,8)+1;
 end
elseif A==1
    data(1,8)=1;
    data(1,7)=0;
    
    
end