MATLAB Answers

Is There a Way to Find all Shadowed Functions on the matlabpath?

9 ビュー (過去 30 日間)
Paul 2021 年 6 月 29 日
コメント済み: Fangjun Jiang 2021 年 6 月 29 日
I'm dealing with a code base of m-files all in one folder and sub-folders. I'm worried that different sub-folders contain files with the same name. If I put all of this on my matlabpath, is there any way to get a list of all shadowed functions, i.e., same-named function m-files in different subfolders? Or do I have to use a dir command and do some sort of count of each file name? Or some other way?


Fangjun Jiang
Fangjun Jiang 2021 年 6 月 29 日
編集済み: Fangjun Jiang 2021 年 6 月 29 日
I am not aware of any direct method. On the other hand, Files=dir('**/*.m') will give you all the M-file names including all sub-folders. Then it would be easy to run unique({}) to find out duplicated file names.
  2 件のコメント
Fangjun Jiang
Fangjun Jiang 2021 年 6 月 29 日
Here is a way to find out duplicated names using unique()
str = ["abc";"defg";"defg";"hij";"klmn";"klmn"];


その他の回答 (0 件)




Community Treasure Hunt

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

Start Hunting!

Translated by