Assignment 3 function headers

findMatch

function idx= findMatch(C, s)
% C is a 1-d cell array of strings with unique entries. 
% Find the first cell in C that matches string s completely, ignoring case.
% idx is a vector of the first index of C where a match occurs.
% E.g., if  C is {'Matt'; 'uses'; 'Matlab'; 'on'; 'a'; 'mAt'} 
%       and  s is 'Mat', then idx is [6]. 
% If there is no match then idx is [].

readTransportData

function transportData = readTransportData(filename)
% This function reads the contents of filename into cell array transportData. 
% filename is a text file in which the first line stores the headers of the 
% dataset while the remaining rows contain the data to be stored in
% transportData, with an exception explained below.  Each column of data in 
% filename is delimited by ','.  
% Exception:  if the 9th column of a row of data contains the value '\N' or 
% '' (empty char array), that row of data should not be stored in 
% transportData. 
%
% transportData is a 2D cell array where each row corresponds to a row in 
% filename excluding the header and each column corresponds to a column of 
% data in filename.  I.e., transportData{r,c} stores the data in the rth
% row cth column of filename, not counting the header row and any row whose 
% 9th column has the value '\N' or ''.

splitTimeZones

function [areas,locations] = splitTimeZones(transportData)
% This function segregates the data value in one of the columns in
% transportData for further data processing.
%
% transportData is a 2D cell array where each row represents a hub of
% public transport. The 9th column contains information about the timezone
% where the public transport utility is located in the tz (Olson) format.
% Each entry in this column takes on the form 'area/location'.
%
% areas and locations are 1D cell arrays such that areas{k} and locations{k}
% store the timezone information separated into area and location, respectively,
% for the kth row in transportData.

indexAirports

function [countries,countryIDs,uniqueAreas,areaIDs,airportIDs] = ...
    indexAirports(transportData,areas)
% This function indexes the data in transportData by identifying the
% countries and time zone areas of all airports contained in the data set.
% The data corresponding to public transport utilities that are not
% airports will not be considered.
%
% Inputs:
%
% transportData is a 2D cell array where each row represents a mode of
% public transport. The 3rd column represents the country where the the
% public transport utility is located while the 10th column represents the
% type of the utility.
%
% areas is a 1D cell array such that areas{k} stores the timezone area 
% for the kth row in transportData.  (See function splitTimeZones.)
%
% Outputs:
%
% countries is a 1D cell array that stores all the unique countries
% referenced in transportData that have at least one public transport 
% utility whose type is 'airport'.
%
% countryIDs is a 1D cell array such that countryID{k} is a numeric array
% storing the row numbers of transportData whose country is countries{k}
% and whose public transport utility type is 'airport'.
%
% uniqueAreas is a 1D cell array that stores all the unique timezone areas
% for which there is a public transport utility of type 'airport'.
%
% areaIDs is a 1D cell array such that areaIDs{k} is a numeric array
% storing the row numbers of transportData whose timezone area is uniqueAreas{k}
% and for which the public transport utility type is 'airport'.
%
% airportIDs is a 1D numeric array that stores the row numbers of
% transportData whose public transport utility
% type is 'airport'.

tabulateDistances

function distances = tabulateDistances(transportData, rEarth)
% Computes the distance between all the public transport utilities.
%
% transportData is a 2D cell array where each row represents a mode of
% public transport. The 4th and the 5th column are the latitude and
% longitude, respectively, in degrees, of the public transport utility.
%
% rEarth is the radius of the earth
%
% distances is a 2D numeric array such that Distance(j,k) is the Haversine 
% distance between the public transport utility corresponding to rows j 
% and k of transportData.  Distance is reported in the same units as rEarth.