Matlab startup file

Use a similar startup.m script below to set figure defaults. This ensures that axis labels are appropriately sized.

Run this command to open the startup file

edit(fullfile(userpath,'startup.m')) 

Once you have run the above, the relevant startup file should appear. You can copy and paste the below as a starter. Comment in or out the relevant scripts.

% Example startup file 

% This adds all paths recursively from the directory
% You can add the relevant directory where you store commonly used functions 
% On windows, you may need to use a directory structure like C:\Users\myuserid\Documents\...
% addpath(genpath('~/myfunctions'));

% This adds a single path
% addpath ~/mysinglepath/

% Set figure default to something more pragmatic

colordef white
set(0, 'Units', 'pixels');

set(0, 'defaultaxesfontsize', 18, 'defaultaxeslinewidth', 1, ...
		'defaultlinelinewidth', 1, 'defaultpatchlinewidth', .7, ...
		'defaultAxesFontSize', 18);


set(0,'DefaultFigureColor','w', ...
		'DefaultAxesColor','w',...
		'DefaultAxesXColor','k',...
		'DefaultAxesYColor','k',...
		'DefaultAxesZColor','k',...
		'DefaultTextColor','k',...
		'DefaultLineColor','k');

clear
close all

% Add the starting path
% cd ~/mystartingpath/

You can try running the script.

If you exit Matlab and restart it, Matlab should run the startup script automatically.

The use of a startup file was common enough for me to make a guide on YouTube: