フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to make the folders correspond to suitable files depending on its similar names

1 回表示 (過去 30 日間)
Kapa Kudaibergenov
Kapa Kudaibergenov 2019 年 11 月 5 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件)

この質問は閉じられています。

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by