MATLAB Function Reference Previous page   Next Page
genpath

Generate 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

addpath, path, pathdef, pathsep, pathtool, rehash, restoredefaultpath, rmpath, savepath

Search Path in the MATLAB Desktop Tools and Development Environment documentation


Previous page  ge genvarname Next page

© 1994-2005 The MathWorks, Inc.