MATLAB: Lsqcurvefit command window exit flag suppression

lsqcurvefitMATLABOptimization Toolboxsuppressing output

lsqcurvefit dumps its exit flags in the work space. i.e
lsqcurvefit stopped because the problem appears to be locally singular.
or
Optimization completed because the size of the gradient is less than the default value of the function tolerance.
is there any way to suppress these outputs in the command window?

Best Answer

You could include options in your call to lsqcurvefit and set Display to 'off':
opts = optimset('lsqcurvefit');
optimset(opts,'Display','off');
... = lsqcurvefit(...,opts);