MathGroup Archive 1997

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

Search the Archive

Re: Combining Lists?


Another possibility is MapThread[List,{{1,2,3},{4,5,6}}] .  Timing -wise 
this is about the same as the Transpose[] option.

Mark

Dr Stephen P Luttrell (luttrell at signal.dra.hmg.gb) wrote:

: Alan Hunter <akh6n at virginia.edu> wrote in article
: <5ut8r0$a50 at smc.vnet.net>...
: > I think this is a pretty easy question so I hope someone will be able
: > to answer it, I just can't figure out how to do it.  If you have two
: > lists, for example {1, 2, 3} and {4, 5, 6}.  Is there a command to
: > combine them into a series of XY pairs like {{1, 4}, {2, 5}, {3, 6}}? 
: > The book doesn't seem to have such a command, but I suspect one exists. 

: Transpose[{{1, 2, 3} ,{4, 5, 6}}]

: produces the output

: {{1,4},{2,5},{3,6}}

: -- 
: Dr Stephen P Luttrell                  luttrell at signal.dra.hmg.gb
: Adaptive Systems Theory                01684-894046 (phone)
: Room EX21, Defence Research Agency     01684-894384 (fax)           
: Malvern, Worcs, WR14 3PS, U.K.        
: http://www.dra.hmg.gb/cis5pip/Welcome.html




  • Prev by Date: NonLinearFit
  • Next by Date: Points to Funciton
  • Previous by thread: Re: Combining Lists?
  • Next by thread: Integer Values