Main Content


Create FactoryGroup root object for toolbox



s = matlab.settings.FactoryGroup.createToolboxGroup(name) creates the root factory group for a toolbox and returns the new group as a FactoryGroup object. By default, the root factory group is hidden, which means that it does not display in the parent settings group.


s = matlab.settings.FactoryGroup.createToolboxGroup(___,Name,Value) specifies the root factory group properties using one or more name-value pair arguments. For example, 'Hidden',false creates a visible FactoryGroup root object. Specify name-value pairs after all other input arguments.


collapse all

Create the root factory group for the toolbox mytoolbox and make it visible.

s = matlab.settings.FactoryGroup.createToolboxGroup('mytoolbox', ...

Create a root factory group and specify a default validation function. This function validates the values of all the factory settings within the group that do not specify their own validation functions. This includes settings in subgroups, as long as the subgroup or settings do not specify their own validation functions.

First, create a validation function numericValidationFcn that throws an error when the input is not numeric.

function numericValidationFcn(x)
    errorMsg = 'Value must be numeric.'; 

Create the root factory group mytoolbox. Specify the validation function numericValidationFcn. MATLAB® throws an error whenever a setting within the root factory settings group is set to a nonnumeric value.

s = matlab.settings.FactoryGroup.createToolboxGroup('mytoolbox', ...

Input Arguments

collapse all

Name of toolbox root factory group, specified as a character vector or string. If the root factory group name already exists, MATLAB displays an error.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: matlab.settings.FactoryGroup.createToolboxGroup('myToolbox','Hidden',false) creates a visible root factory group.

Hidden state, specified as true or false.

When set to true, the factory group, including all factory groups and factory settings within the group, do not display in the Command Window or as part of tab completion, although they remain accessible.

Function to validate factory settings in a group, specified as a function handle. When specified, the function is used to validate the values of all factory settings within the group, except for settings that specify their own validation functions. This includes settings in subgroups, as long as the subgroup or settings do not specify their own validation functions.

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.

Version History

Introduced in R2019b