"Too many input arguments" problem in ga, optimization toolbox. Can someone help help me?

10 views (last 30 days)
Hi guys. I'm using ga (Genetic Algorithm) toolbox. I'm not using code except for my fitness function and the generate initial population function (that, by the way, work since I tested them individually and they returned what I want). Now, the problem is that I can't start the algrithm because matlab always warns me that there are "Too many input argument". Any ideas?
I can add that even if I modify the fitness function and the input arguments (down to 2) matlab always says they are "too many", though I changed that parameter in the toolbox. Thanks

Accepted Answer

Sruthi Geetha
Sruthi Geetha on 12 Feb 2018
GA is part of the Global Optimization Toolbox. However it is possible that you have another version of GA that is not shipped by the MathWorks.
Execute the following on your MATLAB command line to see all versions of GA on your installation:
>> which -all ga
If you see more than one output then you have some that are shadowed. If you would like to use the default GA please run the following:
>> restoredefaultpath
>> rehash toolboxcache
If the above does not help, please try the suggestions in the following link and see if any of that works for you: https://in.mathworks.com/matlabcentral/answers/4077-error-too-many-input-arguments
  2 Comments
Mostafa Nakhaei
Mostafa Nakhaei on 22 Jun 2020
Edited: Mostafa Nakhaei on 22 Jun 2020
Thats worked for me. I had a file "ga.m" in my directory somewhere that was the culprit. It was suppressing the matlab "ga.m" file that was shipped with matlab originally. I simply changed my "ga.m" file to something else and it is working just fine.
Thank you so Much.
Mostafa

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!