I have a lot of data sets combined in a big list where each data set comprises one first level sub-list. Each data set must be saved into a separate file. The names for the files must automatically assigned during export.
How to export different files at the same time?
The basic form of Export
is Export["filename.ext", expr]
, I have not been able to adapt this basic for a sequence of file names, because I don't know how modify the string "filename.ext" to include a sequence number. How could I do that?
I want to generate ten file names using a loop to export the data automatically. I was thinking maybe an expression like
Do[Export["filename[[n]].txt", data[[n]]], {n, 1, 10}]
where the filename is a list {name_1, name_2, name_3, .., name_10}
Do[Export["filename" <> ToString[n]<>".txt", data[[n]]], {n, 1, 10}]
$\endgroup$IntegerString
instead ofToString
to add leading zeros. Check the documentation. $\endgroup$