FAQ
overflow

Great Answers to
Questions About Everything

QUESTION

I have data in file.txt which can be expressed by 20000x11 matrix. I do not want to import all of these data. How can I plot graph of the column 1 & column 4?

{ asked by Gokce }

ANSWER

If the data are comma-delimited and saved as myfile.txt then

data =Import["C:\\Users\\md\\Desktop\\myfile.txt", {"Data",  {All}, {1, 3}}];

imports columns 1 and 3, giving:

(*{{"a1", "a3"}, {"b1", "b3"}, {"c1", "c3"}, {"d1", "d3"}}*)

For comparison,

Import["C:\\Users\\md\\Desktop\\myfile.txt", {"Data"}]

gives

(*{{"a1", "a2", "a3", "a4", "a5"}, {"b1", "b2", "b3", "b4", 
  "b5"}, {"c1", "c2", "c3", "c4", "c5"}, {"d1", "d2", "d3", "d4", 
  "d5"}} *)

More information may be found here ("How to Import a Spreadsheet")

{ answered by TomD }
Tweet