How to find specific files using dir?

8 ビュー (過去 30 日間)
Joshua
Joshua 2013 年 7 月 2 日
How can I use the dir command to look for files with certain parts? For example if I wanted all files in a directory that had 'random' in their names, how would I go about selecting only those files?
I know you can use the wildcard to look for certain strings, but is it possible to do it with variables? If name = random, then how would I look for files with 'random' in their names using just name?
Thanks

採用された回答

the cyclist
the cyclist 2013 年 7 月 2 日
name = 'random';
dir(['*',name,'*'])
  1 件のコメント
Joshua
Joshua 2013 年 7 月 2 日
Thank you so much!

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

その他の回答 (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