PDA

View Full Version : Import multiple files into Mathematica


ChristinaJ
Apr12-11, 11:52 AM
Hi,

I'm trying to import multiple files into Mathematica. Each file is a 2d matrix and I would like to import multiple files into a nested list. So far I have something that only allows me to load a single file.

In:= SetDirectory["/directory"];

In:= filenames = FileNames[]
Out:= {file1,file2,file3, ...}

In:= loaddata[filenumber_] := Import[Part[FileNames[], filenumber]]

I have a strong suspicion that this is very simple but I just can't see the answer.

Thanks in advance for any help,
Christina

ChristinaJ
Apr12-11, 01:42 PM
[SOLVED]

I was right, very simple to solve. Now I have

alldata = Map[Import, filenames];

where filenames={file1,file2,file3,...}