MATLAB: Can I create an OutputFcn property for the Optimization Toolbox solvers like the ODE OutputFcn option

odeoptimizationOptimization Toolboxoutputfcnparameterproperty

The ODE solvers have a parameter in ODESET called OutputFcn.
OutputFcn – Installable output function [ function ]
This output function is called by the solver after each time step. When
a solver is called with no output arguments, OutputFcn defaults to the
function odeplot. Otherwise, OutputFcn defaults to [].
Something like this would be very nice to have for the functions in the Optimization Toolbox. It would provide a way to examine the progress of the optimizer at each step of the process.

Best Answer

This feature has been added to the Optimization Toolbox 2.3 (R13SP1). See the documentation here:
for more information on how to use an output function.
If you are using a version older than the Optimization Toolbox 2.3 (R13SP1), the only workaround is to have the objective function display information each time it is executed.
Related Question