MATLAB: How to change the MATLAB desktop code font size and desktop font size programmatically

desktopfontMATLABprogramatictext;

Best Answer

1) Desktop Code Font: Since MATLAB release R2018a, there is a documented programmatic way to change the Desktop code font. Documentation link can be found below:
Example:
s = settings;
s.matlab.fonts.codefont.Size.TemporaryValue = 12; % points
Change back to default:
clearTemporaryValue(s.matlab.fonts.codefont.Size);
A "TemporaryValue" is just for the current MATLAB session. If you want to make it persistent, then you have to use the "PersonalValue".
Example:
s = settings;
s.matlab.fonts.codefont.Size.PersonalValue = 12; % points Change back to default:
clearPersonalValue(s.matlab.fonts.codefont.Size);
2) Desktop Text Font: Currently, there is no workaround for setting the Desktop Text Font programmatically.