Mathematica Asked on August 31, 2021
I am importing data from ParallelTable
as dat
file and then export it again for visualization. However, the exported data contains a quotation " "
and can not use ListPlot
, here is an example
Y = ParallelTable[{x}, {x, -20, 20, 2}] // AbsoluteTiming;
Export["...Hello3.dat", Y];
data = Import["...Hello3.dat"];
the imported data has this form
{{0.0326645}, {"{-20}", "{-18}", "{-16}", "{-14}", "{-12}", "{-10}",
"{-8}", "{-6}", "{-4}", "{-2}", "{0}", "{2}", "{4}", "{6}", "{8}",
"{10}", "{12}", "{14}", "{16}", "{18}", "{20}"}}
If I use ListPlot[data[[2]]]
it does not give output. So how can I avoid these quotations from the beginning with keeping AbsoluteTiming
?
Well, I have not dug very deep in this issue but just post my experience. And not about why but about how to get rid of the quotation marks.
When I deal with plaintext-wise data, I just use Put
to store the data and later use Get
to get it back in the same form as I Put
it, without the requirement to set up other options. In your case, this should work:
Put[Y, "Hello3.dat"];
data = Get["Hello3.dat"]
No directory specified explicitly means that $UserDocumentsDirectory
(at least in Win 10) is used. You can specify other directory if you prefer.
Correct answer by Αλέξανδρος Ζεγγ on August 31, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP