I have a long txt file (which attached here). I want to import this file and then use a special line (in this case line 112) to plot a graph. I tried this
file = Import["data.txt", "Data"];
den = file[[112]];
den // Dimensions
(*
{303}
*)
As you can see it gives me dimensions {303} while the real dimensions of den must be {303,2} I don't know why Mathematica adds an addiional {} to den. Also when I try "Lines" in Import command it returns all of line 112 as a string. What is the best way to import line 112 as a real table as what I really need to plot?
ToExpressionwhat a useful command. why it may be dangerous? – Wisdom May 07 '21 at 12:55ToExpressionon a string that read"DeleteFile[\"*\"]".... don't try this at home kids.... – Joshua Schrier May 07 '21 at 12:57Printto save several WL expressions to a file and then trying to reconstruct them by reading the file as a string is clunky and brittle. Much better to usePut, orPutAppend, andGet. – Rohit Namjoshi May 07 '21 at 17:42