How to pass input parameter in a function handle
Show older comments
I don't know what it is really called so maybe the title of my question can be misleading. Anyway, I am using simulated annealing and I initially set the options as follows
options = saoptimset('DataType', 'custom', 'AnnealingFcn', @PermuteElements, ...
'StallIterLimit',50, 'ReannealInterval',50, 'PlotInterval', 50, 'AcceptanceFcn', @acceptancesa);
then I called simulated annealing with these options and it works fine.
The problem is that I want to have some input parameters for the function PermuteElements(param1,param2,etc) which I will need inside the function. but when I add them in the options
options = saoptimset(..., @PermuteElements(param1,param2,etc), ...);
I get an error. I don't exactly understand the role of the @ in front of the function. So how should I input the parameters to the function? Also, how can I figure out when (and by which function) will the function I made exactly be called during simulated annealing execution?
Accepted Answer
More Answers (1)
the cyclist
on 13 Jun 2016
0 votes
1 Comment
etudiant_is
on 13 Jun 2016
Edited: etudiant_is
on 13 Jun 2016
Categories
Find more on Simulated Annealing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!