Setting

Object that holds one named setting and its layered values.

Category: Environment and Settings > System Commands

Syntax

S = addSetting(G, name)

Settings are created with addSetting and reached with dot syntax such as s.group.name.

Description

A Setting has five value properties: ActiveValue (read only, the effective value), TemporaryValue, PersonalValue, InstallationValue and FactoryValue. The effective value comes from the first layer that is set, in that order. Assigning to a layer runs the validation function of the setting. Use hasTemporaryValue, hasPersonalValue and the other has...Value methods to query a layer and the clear...Value methods to empty one.

Displaying the object lists all layers, with <no value> for those not set.

Output arguments

S
A matlab.settings.Setting object.

Example

Inspect a setting

s = settings;
g = addGroup(s, 'demo');
a = addSetting(g, 'Level', 'PersonalValue', 3);
a
a.TemporaryValue = 9;
disp(a.ActiveValue)
removeGroup(s, 'demo');
Output
a = 
  Setting 'demo.Level' with properties:

          ActiveValue: 3
       TemporaryValue: <no value>
        PersonalValue: 3
    InstallationValue: <no value>
         FactoryValue: <no value>
     9

Notes

In MatLivre, personal values last for the current session only; they are not saved between runs as MATLAB saves them.

See also

addSetting settings SettingsGroup hasPersonalValue clearPersonalValue