Main Content

matlab.settings.reloadFactoryFile

Load or reload factory settings

Description

example

matlab.settings.reloadFactoryFile(toolboxName) loads or reloads the factory settings tree into MATLAB®. Use matlab.settings.reloadFactoryFile to inspect the factory settings tree while creating it, without having to restart MATLAB. This function is meant for debugging purposes only and should not be included in shipping toolbox code.

Note

  • matlab.settings.reloadFactoryFile does not reload the settingsInfo.json file. You must restart MATLAB after changing the file.

  • You must recreate any variables that reference the specified toolbox after calling matlab.settings.reloadFactoryFile. For example, if you create the variable a = s.mytoolbox and then call matlab.settings.reloadFactoryFile, you must recreate a to access the updated settings for mytoolbox.

Examples

collapse all

Create a toolbox factory tree and then test that the tree is created correctly.

Create the function createMyToolboxFactoryTree that creates the factory settings tree for the toolbox mytoolbox.

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

    toolboxFontGroup = addGroup(myToolboxFactoryTree,'font','Hidden',false)
    addSetting(toolboxFontGroup,'FontSize','FactoryValue',11,'Hidden',false, ...
        'ValidationFcn',@matlab.settings.mustBeNumericScalar)    
    addSetting(toolboxFontGroup,'FontColor','FactoryValue','Black', ...
        'Hidden',false,'ValidationFcn',@matlab.settings.mustBeStringScalar);
end

Create the settingsInfo.json file for the toolbox. Specify mytoolbox as the root settings group name and createMyToolboxFactoryTree as the settings tree creation function. Place settingsInfo.json in the toolbox resources folder.

{
"ToolboxGroupName" : "mytoolbox",
"Hidden" : false,
"CreateTreeFcn" : "createMyToolboxFactoryTree"
}

Add the folder that contains the settings tree creation function and the toolbox resources folder to the MATLAB path. Then, load the factory settings tree for mytoolbox.

matlab.settings.reloadFactoryFile('mytoolbox');

Use the settings function to access the root of the settings tree and display the value of the FontSize setting.

s = settings;
s.mytoolbox.font.FontSize
ans = 
  Setting 'mytoolbox.font.FontSize' with properties:
       ActiveValue: 11
    TemporaryValue: <no value>
     PersonalValue: <no value>
      FactoryValue: 11

Input Arguments

collapse all

Name of toolbox to reload the factory settings for, specified as a string scalar or character vector.

Example: matlab.settings.reloadFactoryFile('mytoolbox');

Introduced in R2019b