hasSetting
Tests whether a settings group contains a setting of a given name.
Category: Environment and Settings > System Commands
Syntax
tf = hasSetting(G, name)
Returns true if group G has a setting called name.
Description
Only direct children of G are checked, and a child group with the same name does not count as a setting. Use it before addSetting to avoid the duplicate-name error.
Input arguments
G- A
SettingsGroupobject. name- Name of the setting to look for.
Output arguments
tf- Logical scalar.
Example
Setting present and absent
s = settings;
g = addGroup(s, 'demo');
addSetting(g, 'Level', 'PersonalValue', 1);
disp(hasSetting(g, 'Level'))
disp(hasSetting(g, 'Other'))
removeGroup(s, 'demo');
Output
1
0