Save output from 'Display' option when using fminsearch to object
Show older comments
I am using fminsearch to find the minimum of an objective function, but I want to be able to store the progress at each iteration in terms of the function value/action taken at that iteration. The following code prints out the information I want to the matlab terminal,
options = optimset('Display','iter')
[x,fval,exitflag,output] = fminsearch(fun,x0,options)
though I don't know how to save it to an object that I can use later on for analysis. Is this possible?
Thanks
Accepted Answer
More Answers (1)
Walter Roberson
on 31 Oct 2017
0 votes
If you do not need to be able to see the output as it is produced, then you can use evalc().
If you do need to be able to see the output as it is produced, then diary()
2 Comments
Will Stone
on 31 Oct 2017
Walter Roberson
on 31 Oct 2017
output = evalc('[x,fval,exitflag,output] = fminsearch(fun,x0,options);')
Categories
Find more on Simulink Design Optimization 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!