First of all, I am pretty inexperienced with Mathematica. I am using it for data analysis for a lab class.

I have a file folder with my data as tab-separated values in .txt files. They are named data_##.txt. I would like to mass import the data into Mathematica, and then generate a ListPlot for each dataset. I don't need to do any analysis on the datasets--just visual inspection of the graphs.

Here is what I tried:

allData=Import["filepath\data_*", "Table"]

This generates

allData={{{x1,y1},{x2,y2},...}, {{x1,y1},{x2,y2},...}}

which is what I expected/wanted to happen. Each dataset is its own list of {x,y} values. Now I need to plot each dataset on a separate plot. When I use


it plots all the datasets on the same graph. I understand why that is but I'm wondering if there's a way to quickly plot all the datasets with the way I've imported them. Right now I've just done

ListPlot[alldata [[a]]]

for each set (a = 1, 2, 3, etc). This works, but I feel like there should be a way to do this automatically.

  • 2
    $\begingroup$ See Map. ListPlot /@ allData $\endgroup$
    – Edmund
    Oct 31, 2018 at 20:46

1 Answer 1


You could try something like


This will do the following: since allData is a list of lists {set,allData} will iterate over all of them and you can do whatever you want with each individual set, e.g., plot it. Note, however, that within a Do loop you'll need to specify //Print in order to get visual output.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.