Main Content

FactorySetting

Factory settings object

Description

A FactorySetting object represents an individual setting within the factory settings tree.

Creation

Create FactorySetting objects within the FactoryGroup root object using the addSetting function. For example:

myToolboxSettings = matlab.settings.FactoryGroup.createToolboxGroup('mytoolbox','Hidden',false);
myFactorySetting = addSetting(myToolboxSettings,'MySetting','Hidden',false,'FactoryValue',10);

Properties

expand all

Name of factory setting, specified as a character vector or string.

Hidden state, specified as true or false.

When set to true, the factory setting does not display in the Command Window or as part of tab completion, although it remains accessible.

Read-only state, specified as true or false. When true, the personal or temporary value of the setting cannot be specified.

Factory value of setting, specified as MATLAB data of any type except for handle types. Data containers such as cell arrays, structs, and objects that include handles are also not supported. You must specify either a factory value or a factory value function for the setting, but not both.

Function to set the setting factory value, specified as a function handle. The factory value of the setting is set to the output of the specified function.

The function handle must point to a function on the MATLAB path. Anonymous or nested function handles are not supported.

You can specify either a factory value or a factory value function for the setting, but not both.

Function to validate a setting value, specified as a function handle. When specified, the function is used to validate the value of the factory setting.

The function handle must be associated with a function that accepts the potential setting value as an input argument, has no output arguments, and throws an error if the validation fails.

The function handle must point to a function on the MATLAB path. Anonymous or nested function handles are not supported.

Examples

collapse all

Create the root factory group for the toolbox mytoolbox and then add a new setting to the tree.

Create the root factory group mytoolbox.

myToolboxFactoryTree = matlab.settings.FactoryGroup.createToolboxGroup('mytoolbox', ...
    'Hidden',false);

Add the setting FontSize and give it a default value. MATLAB returns the new setting as a FactorySetting object.

fontSizeSetting = addSetting(myToolboxFactoryTree,'FontSize','FactoryValue',11,'Hidden',false);

Version History

Introduced in R2019b