getpref

Get custom preference value

Description

example

value = getpref(group,pref) returns the value of the specified preference in the specified group. value can be any MATLAB® data type, including numeric types, character vectors, cell arrays, structures, and objects. If pref specifies multiple preferences, getpref returns the values in a cell array. If the specified preference does not exist, MATLAB returns an error.

Examples

collapse all

Add a preference called version to the mytoolbox group of preferences and then get the preference value.

addpref('mytoolbox','version','1.0')
getpref('mytoolbox','version')
ans =
    '1.0'

Input Arguments

collapse all

Custom preference group name, specified as a character vector or a string scalar.

Example: 'mytoolbox'

Data Types: char | string

Custom preference name, specified as a character vector, a cell array of character vectors, or a string array.

Example: 'version'

Example: {'version','modifieddate','docpath'}

Data Types: char | string

Introduced before R2006a