Create functions to create and then upgrade a toolbox factory
tree and then test that the upgrade completes successfully.
Create the function createMyToolboxFactoryTree
that
creates the factory settings tree for the toolbox
mytoolbox
.
Create the function
createMyToolboxSettingsFileUpgraders
with an empty
settings file upgrader object.
Create the settingsInfo.json
file for the toolbox.
Specify mytoolbox
as the root settings group name,
createMyToolboxFactoryTree
as the settings tree
creation function, and
createMyToolboxSettingsFileUpgraders
as the settings
tree upgrade function. Place settingsInfo.json
in the
toolbox resources
folder.
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
.
Use the settings
function to access the root of the
settings tree and set the personal value for the
MyFontSize
setting.
Change the settings names in createMyToolboxFactoryTree
to be FontSize
and FontColor
.
Record the rename of the two settings in the
createMyToolboxSettingsFileUpgraders
function as
changes to the settings tree for version 2
of
mytoolbox
.
Reload the factory settings tree for
mytoolbox
.
Use the settings
function to access the root of the
settings tree and verify that the personal value for the
FontSize
setting was correctly moved from the
MyFontSize
setting.
ans =
Setting 'mytoolbox.font.FontSize' with properties:
ActiveValue: 15
TemporaryValue: <no value>
PersonalValue: 15
FactoryValue: 11
Get the result of the first upgrade operation for version
2
of mytoolbox
.
ans =
OperationResult with properties:
Operation: "move mytoolbox.font.MyFontSize mytoolbox.font.FontSize"
Status: "Succeeded"
ExceptionLog: [0×0 matlab.settings.ReleaseCompatibilityException]