Re: RE: Joining lists
- To: mathgroup at smc.vnet.net
- Subject: [mg37861] Re: [mg37824] RE: [mg37810] Joining lists
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Fri, 15 Nov 2002 01:36:19 -0500 (EST)
- References: <200211141111.GAA11381@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Your Do loop does what it is instructed to do. It calculates the pair
{a[[i]],b[[i]]} in turn, **but does nothing else** i.e., the result is just
lost somewhere inside your computer. If you set Do[s = {{etc...}}], then
calling s will give the last result stored in s, i.e., {a[[3]],b[[3]]}.
Using Transpose is by far the proper way to do what you want.
Tomas Garza
Mexico City
----- Original Message -----
From: "Pigeon, Robert" <Robert.Pigeon at drdc-rddc.gc.ca>
To: mathgroup at smc.vnet.net
Subject: [mg37861] [mg37824] RE: [mg37810] Joining lists
> Sorry... I just cut and paste from a Notebook!
>
> Here what I am trying to do:
> a={1,2,3};
> b={4,5,6};
> c={{a[[1]],b[[1]]},{a[[2]],b[[2]]},{a[[3]],b[[3]]}}
> {{1,4},{2,5},{3,6}}
>
> I tried: Do[{{a[[i]],b[[i]]}},{i,3}] And it is not working.
>
> Since my first posting I found that Transpose[{a,b}] will do it.
>
> But I would like to know why the Do loop is not doing it !
>
> Thanks,
>
> Robert
>
> -----Original Message-----
> From: Pigeon, Robert [mailto:Robert.Pigeon at drdc-rddc.gc.ca]
To: mathgroup at smc.vnet.net
> To: mathgroup at smc.vnet.net
> Subject: [mg37861] [mg37824] [mg37810] Joining lists
>
>
> Good day,
> Here what I am trying to do:
> <<...OLE_Obj...>>
> <<...OLE_Obj...>>
> <<...OLE_Obj...>>
> <<...OLE_Obj...>>
> Of course my two lists are a lot larger ! So, I would like to build the
new
> list c automatically, from the first item to the last of my lists (number
of
> items is equal in both lists). I tried:
> <<...OLE_Obj...>>
> <<...OLE_Obj...>>
> and other things. But it does not work.
>
> At the end I want to plot (ListPlot) the new list.
>
> Any suggestion?
>
> Thanks
>
>
> Robert Pigeon
>
>
>
- References:
- RE: Joining lists
- From: "Pigeon, Robert" <Robert.Pigeon@drdc-rddc.gc.ca>
- RE: Joining lists