I have data(points) that I have to import from another program to Mathematica, so I can plot it. I have control on how the points are going to be written to the file, so I can put them in any way I want. What is the best way to import them to Mathematica? As I'm going to use StreamDensityPlot, the variable I'll have to pass to StreamDensityPlot will have to be in the following way:
data = {
{
{ a, b, c }, {a, b, c}, {a, b, c},
{ a, b, c }, {a, b, c}, {a, b, c},
{ a, b, c }, {a, b, c}, {a, b, c},
}
...
{
{ a, b, c }, {a, b, c}, {a, b, c},
{ a, b, c }, {a, b, c}, {a, b, c},
{ a, b, c }, {a, b, c}, {a, b, c},
}
}
How would you advice me to put the data in the intermediate text file? And what should I use to import it? I've tried Import["mytext.txt", "List"], having my text file with something in the form shown above but it seems as Mathematica considers the points as strings, and I can't do anything with them. Is there a way to convert strings to arbitrary data as is possible in other languages (provided they are valid in that new data type)?
Recap:
- Is it possible to convert a string, for example, "5" to a number, in Mathematica? If yes, how?
- Is it possible to convert a string like "{1 , 2, 3}" to a list in Mathematica? If yes, how?
- Is it possible to load a CSV file as a list of lists as shown above in Mathematica?
Thanks