%% Add Folder and Subfolders to Search Path
% Use genpath in conjunction with addpath to add a folder and its subfolders to the search path.
% Create a folder myfolder containing a subfolder mysubfolder.

mkdir myfolder;
cd myfolder;
mkdir mysubfolder;
cd ..

%
% Generate a path that includes myfolder and all folders below it.

p = genpath('myfolder')

%
% Add the folder and its subfolders to the search path.

addpath(p)

% Copyright 2012 The MathWorks, Inc.