MATLAB: Particle Swarm – Additional Arguments

global optimisationoptimisationoptimizationparticleswarm

Hello,
I have to send some additional arguments to my objective function fun.
If I do this, I get an error saying that I have too many input arguments.
[xn3,fvaln3,exitflagn3,outputn3] = particleswarm(@fun,nvars,lb,ub,options, additionalArguments);
Then I tried the following thing but I got an error saying I can't have a structure as an input argument.
[xn3,fvaln3,exitflagn3,outputn3] = particleswarm({@fun,additionalArguments},nvars,lb,ub,options);
Thanks in advance!

Best Answer

That older way of passing additional arguments is supported but not documented for older functions. Newer functions do not support it at all.
For supported, documented ways of passing extra parameters, see the documentation.
Alan Weiss
MATLAB mathematical toolbox documentation