Reputation: 15
I want to minimize a very simple function.
function z=f(x)
f=(x(1)-2)^2+(x(2)-1)^2
end
and I write this in matlab command window:
>> [x fval]=ga(@f,2)
But I get this error:
??? Error using ==> ga
Too many input arguments.
Any suggestions to fix this problem?
Upvotes: 0
Views: 1011
Reputation: 36710
If you have multiple ga.m, the build in and your own ga.m in C:\Users\student\Documents\MATLAB\ga.m
, matlab uses
path
Obviously, your ga.m
is first in order, which causes Matlab to call it instead of the buildin. Either fix the path settings, or delete C:\Users\student\Documents\MATLAB\ga.m
Upvotes: 2