Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Loading many data files with one command' topicStudent Support Forum > General > "Loading many data files with one command"

Next Comment >Help | Reply To Topic
Author Comment/Response
Rainer Hörlein
06/21/05 6:32pm

Hello,

I am trying to read in a lot of files that are all of the same form. I can read in every single file with the command posted below (I dont know if this is really the easiest way to do it, but it is the simplest I could come up with since my data contains header lines):

data1 = DropNonNumeric[Import["e:/data1.txt", "Table"]]

I would now like to read in many files named data1.txt, data2.txt, data3.txt etc. and name the corresponding lists data1, data2, data3 etc.

I was trying to use a for loop, but I was not able to make the program that looks something like this:

for[n=1,n<=9,n++,
data'n' = DropNonNumeric[Import["e:/data'n'.txt", "Table"]]

but I cannot find a way to make mathematica vary the filename by sucsessively changing the number in the filename.

Can anybody help me with this problem?

URL: ,

Subject (listing for 'Loading many data files with one command')
Author Date Posted
Loading many data files with one command Rainer Hörlein 06/21/05 6:32pm
Re: Loading many data files with one command yehuda ben-s... 06/24/05 06:06am
Next Comment >Help | Reply To Topic