I currently work on a project where I need to compare the input information to the information in the table and then output the row which is matching the input information. The input information is departure and arrival airport, which is represented with 3 capital letters (i.e. 'DEN', 'JFK). The flight data is stored in .txt file, which is then converted to the table in matlab. When I try to run the for loop, MATLAB outputs an error, saying that '==' cannot be used with the table. Can you please help me to solve this issue? I will attach the code and the .txt file below.
function rv = finalproject(Departure, Arrival)routes = readtable('routes.txt'); % import routes data
planes = readtable('planes.txt'); % import planes data
airlines = readtable('airlines.txt'); % import airlines data
if length(Departure) ~= 3 % check if airport name is correct
error('Check the departure airport')endif length(Arrival) ~= 3 % check if airport name is correct error('Check the arrival airport')endfor i = 1:67663 % stop when gone through all possible
if routes(i, 3) == Departure && routes(i, 5) == Arrival % find the matching row
rv = routes(i, :); % return the matched row
endendend
Best Answer