Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Nested Lists

  • To: mathgroup at
  • Subject: [mg28399] Re: Nested Lists
  • From: "Allan Hayes" <hay at>
  • Date: Mon, 16 Apr 2001 03:28:50 -0400 (EDT)
  • References: <9b8ol0$>
  • Sender: owner-wri-mathgroup at

I have taken N = 2 below, and changed N to NN, since N is protected.


With your reading method



We can proceed:



Changing the reading method slightly

ReadList["temp.txt",Prepend[ Table[Number,{NN},{3}],Number]]


allows us to use the simpler



Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Robert Love" <rlove at> wrote in message
news:9b8ol0$7et at
> I'm confused about nested lists and how to select/extract data from them.
> I have a file of data I can use ReadList to read.  The data is laid out
> like this:
> t1
> x y z
> x y z
> x y z
> x y z
> t2
> x y z
> x y z
> x y z
> x y z
> t3
> etc.
> 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.
> All advice appreciated.
> Bob Love

  • Prev by Date: Re: Mapping a scalar against a list
  • Next by Date: Re: inum error from NIntegrate?
  • Previous by thread: RE: Nested Lists
  • Next by thread: exporting a .bmp sequence of an animation