MATLAB: Genetic Algorithm Additional inputs

gagenetic algorithmMATLAB and Simulink Student Suiteoptimization

So I'm using Matlab's ga tool. I have a function called setup_function that prepares the matrices for the main code. Also, this code has several variables that I want to be able to use in my fitness function for the ga call. So through research, I found the method to do this was to say what I have shown below. I am getting the error "too many input arguments." Any assistance would be greatly appreciated. Thanks.
[x,fval] = ga({@main_function,a,b,c},n,[],[],[],[],LB,UB);

Best Answer

[x,fval] = ga(@(x) main_function(x,a,b,c), n, [], [], [], [], LB, UB);