Import multiple files into Mathematica

  • Mathematica
  • Thread starter ChristinaJ
  • Start date
  • #1
ChristinaJ
Gold Member
43
1
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
 

Answers and Replies

  • #2
ChristinaJ
Gold Member
43
1
[SOLVED]

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

alldata = Map[Import, filenames];

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

Related Threads on Import multiple files into Mathematica

Replies
1
Views
3K
Replies
5
Views
697
Replies
6
Views
12K
Replies
14
Views
9K
Replies
1
Views
2K
  • Last Post
Replies
1
Views
6K
Replies
7
Views
7K
Replies
9
Views
2K
Replies
1
Views
6K
Top