MATLAB: How to select specific text files

text file

I have imported a bench of text file into MATLAB using
list_files2load = dir(fullfile(directory1,'Mod1*));
But then 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 only the ones that end with '*00k.txt'
how could I do that?
Thanks

Best Answer

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)
%or
idx=~cellfun(@isempty,regexp(a,'.+(00k.txt)\>','match'))
b=a(idx)