Add path to the top of MATLAB search paths for current MATLAB session only –
addpath(PATHNAME)
Same as addpath, but stays good for next sessions –
savepath(PATHNAME)
Add all subdirectories for current MATLAB session only –
addpath(genpath(PATHNAME))
Note: One must be careful while adding paths because if there are multiple function files with the same name, the one that is higher up on the path string, is chosen.
More info here – addpath, savepath, genpath.