function f_list = UTM_flights_in_lane(flights,lane_number)
% UTM_flights_in_lane - info on all flights in lane
% On input:
%     flights (flight struct): flight info
%     lane_number (int): lane number
% On output:
%     f_list (kx3 array): info on flights in lane
%       col 1: flight number
%       col 2: distance in lane
%       col 3: time of arrival at lane exit point
% Call:
%     ff = UTM_flights_in_lane(flights,23);
% Author:
%     T. Henderson
%     UU
%     Summer 2020
%

WAITING = 1;
IN_FLIGHT = 0;
DONE = -1;

f_list = [];
num_flights = length(flights);

for f = 1:num_flights
    f_lane_index = flights(f).lane_index;
    f_lane_number = flights(f).traj(f_lane_index);
    if flights(f).status==IN_FLIGHT&(f_lane_number==lane_number)
        f_list = [f_list; f, flights(f).lane_dists(f_lane_index),...
            flights(f).TOA(f_lane_index)];
    end
end

if length(f_list)<2
    return
end

[vals,indexes] = sort(f_list(:,2));
f_list = f_list(indexes,:);
