I need to import about 100000 "dat" files to my progrom. I want to do this using the last answer to this question:
Importing multiple files using a for-loop
I know that I should define a list of all the names of my files, and at the end, I Import
all of them. But I have a problem with this. The names of my files obey a special pattern, like this:
"mutomu,dms41,x1,dms51,x2,q24,x3,q25,x4.dat"
Which x1-x4 are integers in this way:
{x1, 1, 21}, {x2, x1, 21}, {x3, 1, 15}, {x4, 1, 15}
. When I am defining the names of my files, I do it as:
allprobabilityfiles = {Flatten[Table[{{x1, x2, x3, x4},"mutomu,dms41,x1,dms51,x2,q24,x3,q25,x4.dat"}, {x1, 1, 21,1}, {x2, x1, 21, 1}, {x3, 1, 15, 1}, {x4, 1, 15, 1}], 3]};
but in this way, the result is:
....{{21, 21, 6, 5}, "mutomu,dms41,x1,dms51,x2,q24,x3,q25,x4.dat"},
{{21, 21, 6, 6}, "mutomu,dms41,x1,dms51,x2,q24,x3,q25,x4.dat"},
{{21, 21, 6, 7}, "mutomu,dms41,x1,dms51,x2,q24,x3,q25,x4.dat"}, ....
(x1-x4 don't change inside the file names in this table), but what I need is the following:
....{{21, 21, 6, 5}, "mutomu,dms41,21,dms51,21,q24,6,q25,5.dat"},
{{21, 21, 6, 6}, "mutomu,dms41,21,dms51,21,q24,5,q25,6.dat"},
{{21, 21, 6, 7}, "mutomu,dms41,21,dms51,21,q24,5,q25,7.dat"}, ....
How can I solve this problem?