I have imported a bench of text file into MATLAB using
list_files2load = dir(fullfile(directory1,'Mod1*));
In those files (here is an example: Mod1-A-00k.txt, Mod1-A-10k.txt, Mod1-A-30k.txt; Mod1-B-00k.txt, Mod1-B-10k.txt, Mod1-B-30k.txt), I would like to pick first only the ones that end with '*00k.txt', so I do :
a={'Mod1-A-00k.txt', 'Mod1-A-10k.txt', 'Mod1-A-30k.txt', 'Mod1-B-00k.txt', 'Mod1-B-10k.txt', 'Mod1-B-30k.txt'} idx=~cellfun(@isempty,regexp(a,'.+(00k.txt)\>','match')) b=a(idx)
Now I would like to know if it is possible with regexp to create a loop which first starts with piking the files ending with '*00k.txt' and in the second loop the files ending with '*10k.txt' and so on.
Thank you
Best Answer