Output Structures

An output structure contains information on a solver's result. All solvers can return an output structure. To obtain an output structure, invoke the solver with the output structure in the calling syntax. For example, to get an output structure from lsqnonlin, use the syntax

[x,resnorm,residual,exitflag,output] = lsqnonlin(...)
You can also obtain an output structure by running a problem using the Optimization app. All results exported from Optimization app contain an output structure.

The contents of the output structure are listed in each solver's reference pages. For example, the output structure returned by lsqnonlin contains firstorderopt, iterations, funcCount, cgiterations, stepsize, algorithm, and message. To access, for example, the message, enter output.message.

Optimization app exports results in a structure. The results structure contains the output structure. To access, for example, the number of iterations, use the syntax optimresults.output.iterations.

You can also see the contents of an output structure by double-clicking the output structure in the MATLAB® Workspace pane.

Related Topics