I tried many different approaches, but I could not solve the following problems, I appreciate your help:
What is the best way to read many data files? I mean we have file1.dat, file2.dat, file3.dat …
. and I would like to put them in a loop and by using the readlist, import the data, something like what we do in C and sprintf
or in bash scripting. I have seen that there is a package which can handle sprintf
functionality in Mathematica, but I am looking for simpler solution something like this: (I just used $
sign to show what I mean, like bash)
Do[d$i = ReadList["/path/file$i.dat", Number, RecordLists -> True], {i, 1, 5}]
Can I create a variable like d$i
inside the above loop over i? which creates d1, d2, …
, and so on, after running the loop?
How can I remove the curly braces from Mean
output? I have a single list and the Flatten does not remove the curly braces.
tt = {1, 2, 3, 4, ...}
Flatten[Mean[tt]] = {1234.1234}
Mean
? It normally doesn't return a list, but a number. $\endgroup$Mean
command for the single list which is created byReadList
. $\endgroup$