Currently I have:
[s_best,fval_best] = ga(fhandleformatlab,d_fun,,,,,lb_fun, ub_fun,,,options);
[s_best,fval_best,~,~] = particleswarm(fhandleformatlab,d_fun,lb_fun, ub_fun,options);
But I want to save the result of fval at each iteration/generation to an array, so I can analyse how fast the algorithm converges to optimum. I cannot see how to get this output into an array in the matlab workspace.
Note - I do not merely want to display the output, which I can do. I cannot figure out how to output it to an array in the workspace so I can plot it, analyse it etc.