From: cubsfan334 on 10 Mar 2010 01:44 Hello, I have a text file with the coordinates of a number of different points, and I would like to plot them using the ListPointPlot3D command. My text file is arranged like this: x1 *tab* y1 *tab* z1 *tab* x2 *tab* y2 *tab* z2 *tab* x3 etc, with nothing but tabs in between. Is it possible to have mathematica automatically parse this file and insert brackets and commas in the proper place, so the result would look like this: {{x1, y1, z1}, {x2, y2, z2}, {x3, y3, z3}} etc? Thank you very much, cubsfan334
From: Bill Rowe on 11 Mar 2010 06:36 On 3/10/10 at 1:46 AM, cubsfan334(a)gmail.com (cubsfan334) wrote: >I have a text file with the coordinates of a number of different >points, and I would like to plot them using the ListPointPlot3D >command. My text file is arranged like this: >x1 *tab* y1 *tab* z1 *tab* x2 *tab* y2 *tab* z2 *tab* x3 etc, with >nothing but tabs in between. Is it possible to have mathematica >automatically parse this file and insert brackets and commas in the >proper place, so the result would look like this: >{{x1, y1, z1}, {x2, y2, z2}, {x3, y3, z3}} etc? Assuming each item between tabs is a numeric item, then Partition[ReadList[filename, Number],3] will do what you want.
|
Pages: 1 Prev: Dynamically set variable name and value Next: reading expressions in a file |