(translator=PoChien, ChineseSource=PoChien-20020706-13\genpath.html, EnglishSource=c:\matlabr12\help\techdoc\ref\genpath.html)
MATLAB Function Reference    
genpath

產生一個路徑的字串

Syntax

Description

genpath 傳回以遞迴產生的 "在matlabroot/toolbox 底下的所有目錄的路徑" 的字串.

genpath directory 傳回以遞迴產生的 "在 directory 目錄底下的所有目錄的路徑" 的字串.

p = genpath('directory') 把傳回的路徑字串傳給變數p.

Examples

你可以用下面的命令得到一個字串包含 matlabroot\toolbox\images以及所有的其下的目錄:

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

p =

你也可以將genpathaddpath 作連結, 可以得到從命令列將子目錄加入到路徑中. 下面的例子將 \control目錄加到它的目前路徑的子目錄裡.

See Also

path, addpath, rmpath


  gco   get