MATLAB: Display parameter values at each iteration in the optimization

fminsearchoptions

Hello all,
I use "fminsearch" for optimization. I want to display or save the parameter values (x values) at each iteration. Setting 'display' 'iter' in the options only shows the function values. I was wondering how can I display or save the x values at each iteration?
I appreciate your help.
Best, Mona

Best Answer

Use an OutputFcn in the options structure.