Genpath is excluding package folders

4 ビュー (過去 30 日間)
Matthew Brown
Matthew Brown 2017 年 8 月 18 日
コメント済み: Walter Roberson 2017 年 8 月 23 日
Hello,
I am writing a script that requires to know every folder and subfolder, for which genpath() works perfectly.
However, there are a few folders that are packages (and begin with a '+'), and genpath ignores those.
Is it possible to have genpath include those, or some other way to automatically include that?
Thanks!
  1 件のコメント
Walter Roberson
Walter Roberson 2017 年 8 月 23 日
No, it is not possible to set any flags or pass any options to genpath to cause it to return + directories: processing of them is hard-coded. genpath also removes @ directories.

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2017 年 8 月 18 日
Try using dir() with double asterisks. See the help or my attached demo.
  2 件のコメント
Matthew Brown
Matthew Brown 2017 年 8 月 23 日
Thanks, dir('**/*.m') does what I need it to do.
However, does that only work in 2016+? The code I am writing will need to be backwards compatible with versions back to 2012B.
Walter Roberson
Walter Roberson 2017 年 8 月 23 日
You can look in File Exchange for one of the several recursive directory functions, such as https://www.mathworks.com/matlabcentral/fileexchange/32226-recursive-directory-listing-enhanced-rdir

サインインしてコメントする。

その他の回答 (1 件)

Jan
Jan 2017 年 8 月 23 日

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by