MATLAB Function Reference    
genpath

Generate a path string

Syntax

Description

genpath returns a path string formed by recursively adding all the directories below matlabroot/toolbox.

genpath directory returns a path string formed by recursively adding all the directories below directory.

p = genpath('directory') returns the path string to variable, p.

Examples

You generate a path that includes matlabroot\toolbox\images and all directories below that with the following command:

p = genpath(fullfile(matlabroot,'toolbox','images'))

p =

You can also use genpath in conjunction with addpath to add subdirectories to the path from the command line. The following example adds the \control directory and its subdirectories to the current path.

See Also

path, addpath, rmpath


 gco get