Main Content

Setting

Represents individual setting

Description

A Setting object represents an individual setting within the settings hierarchical tree.

Creation

Access individual Setting objects using the root SettingsGroup object returned by the settings function. For example, this code accesses the MaxWidth setting.

s = settings
s.matlab.editor.language.matlab.comments.MaxWidth

Properties

expand all

Current or active setting value, specified as MATLAB data of any type except for handle types. Data containers such as cell arrays, structs, and objects that include handles are also not supported.

The active value is determined as follows:

  • If the setting has a temporary value, then the active value is the temporary value.

  • If the setting has no temporary value, but it has a personal value, then the active value is the personal value.

  • If the setting has no temporary or personal value, but it has an installation value, then the active value is the installation value.

  • If the setting has no temporary, personal, or installation value, then the active value is the factory value.

For example, suppose you have a setting MySetting with these values:

  • Temporary value: 12

  • Personal value: no value

  • Installation value: no value

  • Factory value: 10

In this case, the active value for MySetting is the temporary value, 12.

Temporary setting value, specified as MATLAB data of any type except for handle types. Data containers such as cell arrays, structs, and objects that include handles are also not supported.

The temporary value is available only for the current MATLAB session and is cleared at the end of the session.

Some settings can be modified interactively using the Settings window. Changing the temporary value of a setting temporarily changes the value of the setting in the Settings window. At the end of the MATLAB session, the setting reverts to its original value.

Personal setting value, specified as MATLAB data of any type except for handle types. Data containers such as cell arrays, structs, and objects that include handles are also not supported.

The personal value is persistent across MATLAB sessions for an individual user. When modified, the value is saved to the settings folder.

Some settings can be modified interactively using the Settings window. Changing the personal value of a setting changes the value of the setting in the Settings window.

Installation setting value, specified as MATLAB data of any type except for handle types. Data containers such as cell arrays, structs, and objects that include handles are also not supported.

The installation value is available from a given MATLAB installation. When modified, the value is saved to the MATLAB root. The value persists across sessions, but it does not migrate during upgrades to new versions of MATLAB.

Some settings can be modified interactively using the Settings window. If changing the installation value of a setting changes the active value of the setting, value of the setting changes in the Settings window as well.

This property is read-only.

Factory setting value, specified as MATLAB data of any type except for handle types. Data containers such as cell arrays, structs, and objects that include handles are also not supported.

The factory value is the default product setting. It is not modifiable. In addition, you cannot specify the factory value for a custom setting.

Object Functions

clearTemporaryValueClear temporary value for setting
clearPersonalValueClear personal value for setting
clearInstallationValueClear installation value for setting
hasTemporaryValueDetermine whether setting has temporary value set
hasPersonalValueDetermine whether setting has personal value set
hasInstallationValue Determine whether setting has installation value set
hasFactoryValueDetermine whether setting has factory value set

Examples

collapse all

View the current values for the maximum column width for comments in the Editor.

s = settings;
s.matlab.editor.language.matlab.comments.MaxWidth
ans = 
 Setting 'matlab.editor.language.matlab.comments.MaxWidth' with properties.

       ActiveValue: 80
    TemporaryValue: 80
     PersonalValue: <no value>
 InstallationValue: <no value>
      FactoryValue: 75

Get and set the value for the maximum column width for comments in MATLAB.

Get the root SettingsGroup object and view the active value for the maximum column width for comments in MATLAB.

s = settings;
s.matlab.editor.language.matlab.comments.MaxWidth.ActiveValue
ans =
  int32
   75

Set the temporary value for the maximum column width for comments in MATLAB.

s.matlab.editor.language.matlab.comments.MaxWidth.TemporaryValue = 80;
s.matlab.editor.language.matlab.comments.MaxWidth.ActiveValue
ans =
  int32
   80

Version History

Introduced in R2018a