Main Content

resetoptions

Reset options

Description

example

options2= resetoptions(options,optionname)resets the specified option back to its default value.

Tip

If you want only one set of options, useoptionsas the output argument instead ofoptions2.

example

options2= resetoptions(options,multioptions)resets multiple options back to their default values.

Examples

collapse all

Create options with some nondefault settings. Examine theMaxIterationssetting.

options = optimoptions('fmincon','Algorithm','sqp','MaxIterations',2e4,...'SpecifyObjectiveGradient',真正的);选项。MaxIterations
ans = 20000

Reset theMaxIterationsoption to its default value.

options2 = resetoptions(options,'MaxIterations'); options2.MaxIterations
ans = 400

The default value of theMaxIterationsoption is 400 for the'sqp'algorithm.

Create options with some nondefault settings. Examine theMaxIterationssetting.

options = optimoptions('fmincon','Algorithm','sqp','MaxIterations',2e4,...'SpecifyObjectiveGradient',真正的);选项。MaxIterations
ans = 20000

Reset theMaxIterationsandAlgorithmoptions to their default values. Examine theMaxIterationssetting.

multiopts = {'MaxIterations','Algorithm'}; options2 = resetoptions(options,multiopts); options2.MaxIterations
ans = 1000

The default value of theMaxIterationsoption is 1000 for the default'interior-point'algorithm.

Input Arguments

collapse all

Optimization options, specified as an object as created byoptimoptions.

Example:optimoptions('fmincon','Algorithm','sqp','SpecifyObjectiveGradient',true)

Option names, specified as a name in single quote marks. The allowable option names for each solver are listed in theoptionssection of the function reference page.

Example:'Algorithm'

Data Types:char

Multiple options, specified as a cell array of names.

Example:{'Algorithm','OptimalityTolerance'}

Data Types:cell

Output Arguments

collapse all

Optimization options, returned as an object as created byoptimoptions.

Version History

Introduced in R2016a

See Also

Topics