MATLAB: How to import different *.txt file into matlab

data importloadMATLABtext file

Hello i want to import to matlab a lot of data files with one line to write on MatLab instead of that all line. My files lookslike these examples below. I would like get some hints on how to import the files where the numerical series are the same in the different file. What I mean is, how do I import the files aaa_bbb_ccc01_123456789.txt, aaa_bbb_ccc02_123456789.txt, aaa_bbb_ccc03_123456789.txt.
I thought this way but I don't know how to insert the numerical series after 1234
for i = 1:3
filename=sprintf('aaa_bbb_ccc%02d_1234.txt',i);
load(filename);
end
aaa_bbb_ccc01_123456789.txt
aaa_bbb_ccc01_123467890.txt
aaa_bbb_ccc01_123478901.txt
aaa_bbb_ccc01_123489012.txt
aaa_bbb_ccc02_123456789.txt
aaa_bbb_ccc02_123467890.txt
aaa_bbb_ccc02_123478901.txt
aaa_bbb_ccc02_123489012.txt
aaa_bbb_ccc03_123456789.txt
aaa_bbb_ccc03_123467890.txt
aaa_bbb_ccc03_123478901.txt
aaa_bbb_ccc03_123489012.txt

Best Answer

To the best of my knowledge the 'import' commands are just not intended to handle more than one file at a time, so your best bet is to get a list and then loop the list.
for i = 1:3;
flist = dir(['aaa_bbb_ccc',num2str(i),'*.txt']);
for j = 1:length(flist);
load(flist(j).name);
end
end