Re: Nested Lists
- To: mathgroup at smc.vnet.net
- Subject: [mg28387] Re: [mg28373] Nested Lists
- From: BobHanlon at aol.com
- Date: Sun, 15 Apr 2001 00:13:38 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
n = 5;
data = Table[{ToExpression["t"<>ToString[t]],
Table[{ToExpression["x"<>(lab = ToString[10t+s])],
ToExpression["y"<>lab], ToExpression["z"<>lab]}, {s, 4}]}, {t,
n}];
pos = 4;
Table[Flatten[{data[[k, 1]], data[[k, 2, pos]]}], {k, n}]
{{t1, x14, y14, z14},
{t2, x24, y24, z24},
{t3, x34, y34, z34},
{t4, x44, y44, z44},
{t5, x54, y54, z54}}
Bob Hanlon
In a message dated 2001/4/14 3:01:03 AM, rlove at neosoft.com writes:
>The data consists of a timestamp on a line and then the 3D position of
>
>each of the N objects for that time. N is always the same number
>so I read it it like this:
>
>ReadList["file",{Number, Table[Number, Number, Number,{N}]}]
>
>I'm doing this from memory since the computer w/Mathematica is at work.
>So I may not have every detail of the ReadList correct but what I end
>up
>with is
>
>{{t1,{{x,y,z},{x,y,z},{x,y,z},{x,y,z}},
> {t2,{{x,y,z}...
>
>
>My question is now do I extract this suitable for graphing, that is,
>how
>do I turn this into something like a set of all the object #4 positions
>along with the time? I'm sure there is some combination of Flatten, Take,
>Transpose and Map that will do what I want. What is it? Also, is there
>a better way to use ReadList? I'm stuck with the file format but I can
>change how I read the data.
>