If I have files with multiple names and I want to select only few from them, how can I do that in MATLAB. For e.g. I have the following file names in a directory
1adl.txt, 2adl.txt...
1adlKey.txt, 2adlKey.txt ...
where *adl.txt are the files containing data and *Key.txt are the files containing 'keys' to extract useful information from a*.txt
The problem is when I use
files = dir(fullfile(newdir,'*.txt') );
it gives me all the .txt files, whereas I want to read a*.txt and a*Key.txt separately, so I can do a one-to-one correspondence between them. Can regular expression be used here? If so, then how?
Any help will be appreciated.