Re: Try again, how to interleave two lists?
- To: mathgroup at smc.vnet.net
- Subject: [mg9682] Re: Try again, how to interleave two lists?
- From: pewei at no_spam.algonet.se (Infotek)
- Date: Fri, 21 Nov 1997 01:31:19 -0500
- Organization: FMV:FLYG
- Sender: owner-wri-mathgroup at wolfram.com
In article <643e45$5bb at smc.vnet.net>, hennig at itwm.uni-kl.de says...
> rob peterson wrote:
>
> > I have two lists of 3D points which in ColumnForm, list A looks like::
> > (In ColumnForm)
> >
> > {Ax1,Ay1,Az1}
> > {Ax2,Ay2,Az2}
> > .
> > .
> > {Axn,Ayn,Azn}
> >
> > B looks the same but with B entries.
> >
> > What I need is a list which looks like
> >
> > {
> > {{Ax1,Ay1,Az1},{Bx1,By1,Bz1},{Ax2,Ay2,Az2},{Bx2,By2,Bz2}....{Bxn,Byn,Bzn}
> > }
> >
> > Any suggestions on how to form this from the two A, B lists?
>
With a={{Ax1,Ay1,Az1},{Ax2,Ay2,Az2},{Ax3,Ay3,Az3}}
b={{Bx1,By1,Bz1},{Bx2,By2,Bz2},{Bx3,By3,Bz3}}
Try:
Flatten[Transpose[{a, b}],1]
which gives:
{
{Ax1,Ay1,Az1},{Bx1,By1,Bz1},{Ax2,Ay2,Az2},
{Bx2,By2,Bz2},{Ax3,Ay3,Az3},{Bx3,By3,Bz3} }