using gatool in MATLAB, by default the function will be minimized:
"Fitness function (required) is the objective function you want to minimize. You can specify the function as a function handle of the form @objfun, where objfun.m is a function file that returns a scalar." -MATLAB Help
If I understood correctly, your objective function has one decision variable only. The variable is 'h' and objective function value is 'X'. So, in GA 'individual' will has only one 'gene' in the 'chromosome'.
Try with, [SOL OFV]=ga(@(IND) time(IND),options); from MATLAB command line or by using GUI of 'gatool' MATLAB toolbox as Mohammad suggested.
Above, 'SOL' is solution individual from GA, 'OFV' is objective function value, 'options' is argument of MATLAB 'ga' function and can be defined by using MATLAB 'gaoptimset' function. You can find more details in MATLAB help for 'ga' and 'gaoptimset' functions.
What I understand of your problem is that you would like to find the best order of passengers so that the total waiting time for passenger is minimal. In such a case, your problem is not to minimize a function. The function to evaluate the waiting time of passenger is predefined and fixed, but the input of the parameters, the order of the passengers, determine how long the waiting time will be. Right?
Ok, then I am right. What you want to optimize is the transit schedule, that is the order of passengers. I think your problem is quite similar to job-shop scheduling problem, that is a benchmark problem in heuristic search. I believe you will find a lot of papers to solve this job-shop scheduling problem with GA.