This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

resetoptions

Syntax

options2 = resetoptions(options,optionname)
options2 = resetoptions(options,multioptions)

Description

example

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

Tip

If you want only one set of options, use options as the output argument instead of options2.

example

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

Examples

collapse all

Create options with some nondefault settings. Examine the MaxIterations setting.

options = optimoptions('fmincon','Algorithm','sqp','MaxIterations',2e4,...
    'SpecifyObjectiveGradient',true);
options.MaxIterations
ans =

       20000

Reset the MaxIterations option to its default value.

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

   400

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

Create options with some nondefault settings. Examine the MaxIterations setting.

options = optimoptions('fmincon','Algorithm','sqp','MaxIterations',2e4,...
    'SpecifyObjectiveGradient',true);
options.MaxIterations
ans =

       20000

Reset the MaxIterations and Algorithm options to their default values. Examine the MaxIterations setting.

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

        1000

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

Input Arguments

collapse all

Optimization options, specified as an object as created by optimoptions.

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 the options section 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 by optimoptions.

Introduced in R2016a