Main Content

matlab.settings.reloadFactoryFile

Load or reload factory settings

Description

example

matlab.settings.reloadFactoryFile(toolboxName)加载或加载树的工厂设置成马TLAB®. Usematlab.settings.reloadFactoryFileto update the factory settings tree before inspecting 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.reloadFactoryFiledoes not reload thesettingsInfo.jsonfile. You must restart MATLAB after changing the file.

  • You must recreate any variables that reference the specified toolbox after callingmatlab.settings.reloadFactoryFile. For example, if you create the variablea = s.mytoolboxand then callmatlab.settings.reloadFactoryFile,你必须重新创建ato access the updated settings formytoolbox.

Examples

collapse all

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

Create the functioncreateMyToolboxFactoryTreethat creates the factory settings tree for the toolboxmytoolbox.

functionmyToolboxFactoryTree = 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 thesettingsInfo.jsonfile for the toolbox. Specifymytoolboxas the root settings group name andcreateMyToolboxFactoryTreeas the settings tree creation function. PlacesettingsInfo.jsonin the toolboxresourcesfolder.

{“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 formytoolbox.

matlab.settings.reloadFactoryFile('mytoolbox');

Use thesettingsfunction to access the root of the settings tree and display the value of theFontSizesetting.

s = settings; s.mytoolbox.font.FontSize
ans = Setting 'mytoolbox.font.FontSize' with properties: ActiveValue: 11 TemporaryValue:  PersonalValue:  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