hasSetting - Determine if setting exists in settings group - MATLAB (original) (raw)

Main Content

Determine if setting exists in settings group

Syntax

Description

hasSetting([parentgroup](#mw%5F49d5a932-2f80-458a-bb7e-ad2bdcc129b6),[name](#mw%5F7afa0fc5-7c0b-4731-8458-51f788ca88cc)) returns 1 if the specified settings group contains a setting called name. Otherwise, hasSetting returns0.

example

Examples

collapse all

Check whether a setting exists before adding it.

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

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

Check whether the MyWorkAddress setting exists before adding it to mysettings.

if hasSetting(s.mysettings,'MyWorkAddress') == 0 addSetting(s.mysettings,'MyWorkAddress','PersonalValue','3 Apple Hill Drive'); end s.mysettings

ans = SettingsGroup 'mysettings' with properties: MyWorkAddress: [1×1 Setting]

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 in the tree.

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

Version History

Introduced in R2019b