Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to make the folders correspond to suitable files depending on its similar names
2 次查看(过去 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!