Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How to make the folders correspond to suitable files depending on its similar names
1 回表示 (過去 30 日間)
古いコメントを表示
I have folders' names in a variable nameFolds1("DYT" "HC9" "HC" "MS_3R" "MS" "PN5_3R" "T"). The 'files' variable contains names of files(like DYT02_OFF,HC907,HC505,MS010_3R,MS010,PN532_3R,T27).
So each folder name should head the corresponding list of files. With DYT, HC9, HC and T it's easy, because I can just use the startswith function.
The problem with MS_3R and PN5_3R, that its files have some numbers before the _ sign(e.g. MS010_3R and PN532_3R). If somebody knows how to deal with it, answer me please.
for i = 1:Numb_of_folds
pattern = nameFolds1(i);
TF = startsWith(files,pattern);
Z = files(TF);
files(ismember(files,Z)) = [];
s = size(Z);
Z = cellstr(Z.');
fprintf(fid1,'%s\r\n',Z{:});
fprintf(fid1,'\n');
end
0 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!