I am looking to import multiple .txt files. So far I have been importing them individually like this:
file1 = Import["C:\\file1.txt", "Table"];
I'd like to be able to do files[1], files[2], etc., instead of assigning individual file names to each import.
I tried doing the method described in the top answer of this post: Importing multiple files using a for-loop
But typing the following, I get "file not found during input"
testlist =
Table[
Import[
"C:\\Users\\joep\\Documents\\Scenario 2\\Climb\\Climb 90000 0.78.txt" <>
ToString[i] <> ".txt,",
"Data"],
{i, 4}]
FileNames["*.txt", "C:\\Users\\joep\\Documents\\Scenario 2\\Climb"]
{"C:\\Users\\joep\\Documents\\Scenario 2\\Climb\\Climb 100000 0.78.txt", "C:\\Users\\joep\\Documents\\Scenario 2\\Climb\\Climb 100000 240.txt", "C:\\Users\\joep\\Documents\\Scenario 2\\Climb\\Climb 100000 300.txt", "C:\\Users\\joep\\Documents\\Scenario 2\\Climb\\Climb 90000 0.78.txt", "C:\\Users\\joep\\Documents\\Scenario 2\\Climb\\Climb 90000 240.txt", "C:\\Users\\joep\\Documents\\Scenario 2\\Climb\\Climb 90000 300.txt"}
0.78.txt.123.txtfori=123? – Niki Estner Nov 14 '17 at 11:47Table[so it returns the list of filenames instead of callingImport. Then change the string expression until it returns the right file names. – Niki Estner Nov 14 '17 at 12:13FileNames["*.txt", "C:\\Users\\joep\\Documents\\Scenario 2\\Climb"]and paste in the results of that in your question. – J. M.'s missing motivation Nov 14 '17 at 12:33Import[#, "Data"] & /@ FileNames["*.txt", "C:\\Users\\joep\\Documents\\Scenario 2\\Climb"], then. – J. M.'s missing motivation Nov 14 '17 at 12:48table1a = Cases[climb90078, {_, _, _, _, __}];– JoepM Nov 14 '17 at 13:42