フィルターのクリア

Checking the existence of any file with a specific extension in a directory

52 ビュー (過去 30 日間)
TP Das
TP Das 2015 年 3 月 11 日
編集済み: Stephen23 2015 年 3 月 12 日
I require to check whether any file exists with a specific extension in a given folder. Let us say, I look for whether any .pdf file is present in my working directory. MATLAB does not accept wildcard commands like
exist('*.m')
Any solution?

採用された回答

Stephen23
Stephen23 2015 年 3 月 11 日
編集済み: Stephen23 2015 年 3 月 12 日
Use dir instead. If you only want to know about the existence, then you could simply check if the returned structure is not empty:
~isempty(dir('*.m'))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by