As usual with Mathematica there is a variety of ways to do what you want. Here are some pieces you may be able to assemble into a solution which works for you.
You could replace your sequence of 4 function invocations with a composition of them all, like this:
ListPlot[Drop[Import["/path/4He.H2O.MeV15670.ddd.gd.dat", "Table"], 9]]
This is initially a lot harder to interpret (for you, Mathematica won't have a problem) but it will be easier to use in what follows, and it will avoid cluttering up your workspace with unnecessary temporary variables. Note that I've replaced your Take[expr,{9,Length[expr]}]
with the equivalent Drop[expr,8]
to avoid having to call Length
on the imported data file.
Now we can tidy this up into a function, such as:
makePlot[fn_String] := ListPlot[Drop[Import[fn, "Table"], 8]]
Next, lets get all the filenames you need. I suppose that your current working directory is the parent of "/path" and that the call
hefiles = FileNames["4He.*.ddd.gd.dat", {"*"}, Infinity];
will return a list of the names of all your input files. Let's modify the makePlot
function for reasons which will become obvious in a moment:
makePlot[ix_Integer, fn_String] := myPlots[ix] = ListPlot[Drop[Import[fn, "Table"], 9]];
Now, you can write
Do[makePlot[i,heFiles[[i]]],{i,1,Length[heFiles}]
and this ought, if I've got the syntax right and matched up all the brackets, to make all your plots with one statement. They will now be stored as myPlots[1], myPlots[2], ...
.
If you want to set options for your ListPlot
command simply amend the definition of makePlot
to something like
makePlot[fn_String] := ListPlot[Drop[Import[fn, "Table"], 8],plotOption-> setting, plotOption2->setting2]
or, if you want to make leaps and bounds in your Mathematica knowledge, investigate the Options
function and you can modify makePlot
to take options as (optional) arguments and pass them through to ListPlot
.