User-Defined Preferences - GNU Octave
Description: GNU Octave

Previous: GUI Utility Functions, Up: GUI Development

### 35.4 User-Defined Preferences

— Function File: addpref (group, pref, val)

> Add a preference pref and associated value val to the named preference group group.

> The named preference group must be a character string.

> The preference pref may be a character string or a cell array of character strings. The corresponding value val may be any value, or, if pref is a cell array of strings, val must be a cell array of values with the same size as pref.

> See also: setpref, getpref, ispref, rmpref.

— Function File: getpref (group, pref, default)

> Return the preference value corresponding to the named preference pref in the preference group group.

> The named preference group must be a character string.

> If pref does not exist in group and default is specified, return default.

> The preference pref may be a character string or a cell array of character strings. The corresponding default value default may be any value, or, if pref is a cell array of strings, default must be a cell array of values with the same size as pref.

> If neither pref nor default are specified, return a structure of preferences for the preference group group.

> If no arguments are specified, return a structure containing all groups of preferences and their values.

> See also: addpref, setpref, ispref, rmpref.

— Function File: ispref (group, pref)

> Return true if the named preference pref exists in the preference group group.

> The named preference group must be a character string.

> The preference pref may be a character string or a cell array of character strings.

> If pref is not specified, return true if the preference group group exists.

> See also: getpref, addpref, setpref, rmpref.

— Function File: rmpref (group, pref)

> Remove the named preference pref from the preference group group.

> The named preference group must be a character string.

> The preference pref may be a character string or a cell array of character strings.

> If pref is not specified, remove the preference group group.

> It is an error to remove a nonexistent preference or group.

> See also: addpref, ispref, setpref, getpref.

— Function File: setpref (group, pref, val)

> Set a preference pref to the given val in the named preference group group.

> The named preference group must be a character string.

> The preference pref may be a character string or a cell array of character strings. The corresponding value val may be any value, or, if pref is a cell array of strings, val must be a cell array of values with the same size as pref.

> If the named preference or group does not exist, it is added.

> See also: addpref, getpref, ispref, rmpref.