How can I migrate my color preference settings of MATLAB from one machine to another in MATLAB R2023a?

9 views (last 30 days)
Instead of migrating all my preference settings of MATLAB from one machine to another, I only want to migrate my color preference settings. How can I do that?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Nov 2025 at 0:00
Edited: MathWorks Support Team on 10 Nov 2025 at 11:58
You can migrate your MATLAB color preference settings from one machine to another by following the steps below:
1. Manually change the color preferences on the current machine.
2. Save the customized color preferences into a MAT file called “colors.mat” by executing the following script. 
s = settings;
colors = s.matlab.colors;
colorCache = struct();
for key = properties(colors)'
try
% copy matlab.colors
colorCache.(key{1}).value = colors.(key{1}).PersonalValue;
catch err
% color is not customised by the user
if strcmp(err.identifier, 'MATLAB:settings:config:UndefinedSettingValueForLevel')
continue
else
% copy matlab.colors.commandwindow and programmingtools
for otherKeys = properties(colors.(key{1}))'
try
colorCache.(key{1}).(otherKeys{1}).value = colors.(key{1}).(otherKeys{1}).PersonalValue;
catch
end
end
end
end
end
% save colorSettings to a MAT File
save colors.mat colorCache;
3. Send the “colors.mat” file to the second machine. Save the existing preference settings on the second machine somewhere as a backup. Please refer to the following link to locate where MATLAB stores preferences: 
4. Load the “colors.mat” file which includes the customized color preferences by executing the following script. 
% load colorSettings
load colors.mat colorCache
s = settings;
colors = s.matlab.colors;
for key = fieldnames(colorCache)'
try
% copy matlab.colors
colors.(key{1}).PersonalValue = colorCache.(key{1}).value;
catch err
% color is not customised by the user
if strcmp(err.identifier, 'MATLAB:settings:config:UndefinedSettingValueForLevel')
else
% copy matlab.colors.commandwindow and programmingtools
for otherKeys = fieldnames(colorCache.(key{1}))'
colors.(key{1}).(otherKeys{1}).PersonalValue = colorCache.(key{1}).(otherKeys{1}).value;
end
end
end
end
5. Restart MATLAB on the second machine if the color preferences changes are not reflected.
There are two things to note with the provided scripts: 
1. Only the colors manually changed in Step 1 will be reflected on the second machine. The colors that are not changed will not be impacted. 
2. While most of the color settings can be migrated, you will need to manually change the “Text” and “Background” preference settings if you want them to be customized. For your reference, you can follow the procedures listed in the Change Text and Background Colors section via the following link to change their colors:
To learn more about the other color settings, you can refer to the link below:

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!