First you can read all the files inside your directory. Assuming the location of your folder is stored in the string path
, use:
a=dir(mypath);
Now you have a structure a
. File names are stored in a.name
. Now you can work with it. Here is a very rough code. You loop over all the files, check if the first letter is a
(there could be some hidden files, you don't need them). Then you extract the data you need from the eligible files.
n=0;
for i=1:numel(a)
if a(i).name(1)=='a'
n=n+1;
numbers{n}=strcat(a(i).name(2:5),a(i).name(8:9),a(i).name(11:12));
letters{n}=a(i).name(13:find(a(i).name=='.')-1);
end
end