matlab.settings.FactoryGroup.createToolboxGroup

Create FactoryGroup root object for toolbox

Description

example

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.

example

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.

Examples

collapse all

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

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

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.'; 
    assert(isnumeric(x),errorMsg);
end

Create the root factory group mytoolbox. Specify the validation function numericValidationFcn.

s = matlab.settings.FactoryGroup.createToolboxGroup('mytoolbox', ...
    'Hidden',false,'ValidationFcn',@numericValidationFcn);

MATLAB® throws an error whenever a setting within the root factory settings group is set to a nonnumeric value.

Input Arguments

collapse all

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

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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, although they remain accessible.

Function to validate factory settings in group, specified as a function handle. When specified, the function is used to validate the values of all 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.

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.

Introduced in R2019b