how skip some specific files in multiple subfolders in matlab?

2 ビュー (過去 30 日間)
Neda
Neda 2019 年 4 月 27 日
コメント済み: Neda 2019 年 4 月 28 日
I need to skip some specific files in different sub-folders. for example if the filename not contains string charchters such as raw, info, do some operations.
dirName = 'D:\Neda\Pytorch\CAMUS\training\';
fileList = SureScan_getAllFiles(dirName);
for k = 1:length(fileList)-50
filename = fileList{k};
%if filename not contain 'raw') | 'Info_' | 'sequence.mhd' | '_sequence'
% do some operation
end
end

採用された回答

Walter Roberson
Walter Roberson 2019 年 4 月 27 日
if ~contains(filename, {'raw', 'Info_', 'sequence.mhd', '_sequence'})
% do some operation
end
contains() requries R2016b or later.
  1 件のコメント
Neda
Neda 2019 年 4 月 28 日
Thanks a lot @Walter Roberson

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

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