Font size can be changed in MATLAB using preferences or settings. On the Home tab, in the Environment section, click Preferences. Select MATLAB > Fonts and, in the Desktop code font section, select a font size. In MATLAB Online, these preferences are located under MATLAB > Appearance > Fonts.
You can find more details on how to change font size for different tools using the doc link below: