Main Content

hasGroup

Determine if settings group exists

Description

hasGroup(parentgroup,name) returns 1 if the settings group parentgroup contains a settings group called name. Otherwise, hasGroup returns 0.

example

Examples

collapse all

Check whether a settings group exists before adding it.

Use the settings function to access the root of the settings tree and then create the settings group mysettings.

s = settings;
addGroup(s,'mysettings');

Check whether a settings group called myothersettings exists before adding it to mysettings.

if hasGroup(s.mysettings,'myothersettings') == 0
    addGroup(s.mysettings,'myothersettings');
end
s.mysettings
ans = 
  SettingsGroup 'mysettings' with properties:
      myothersettings: [1×1 SettingsGroup]

Input Arguments

collapse all

Parent settings group, specified as a SettingsGroup object. Use the settings function to access the root settings group object and all the available settings groups.

Name of the settings group to check for, specified as a character vector or string scalar.

Version History

Introduced in R2019b