Re: Creating List
- To: mathgroup at smc.vnet.net
- Subject: [mg125532] Re: Creating List
- From: Peter Pein <petsie at dordos.net>
- Date: Sun, 18 Mar 2012 02:39:21 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jk1ft6$50r$1@smc.vnet.net>
Am 17.03.2012 08:53, schrieb Harry:
> Hi out there,
>
>
> I have calculated some x- and y-values and want to combine them in a
> way that the x and y-values define coordinates. Well, I have:
>
> xkoor[i], {i, 1, iend} and
> ykoor[j], {j, 1, jend}
>
>
> To be able to continue I need this list:
>
> {{xkoor[1],ykoor[1]},
> {xkoor[2],ykoor[1]},
> {xkoor[3],ykoor[1]},
> {xkoor[4],ykoor[1]},
> {xkoor[1],ykoor[2]},
> {xkoor[2],ykoor[2]},
> {xkoor[3],ykoor[2]},
> {xkoor[4],ykoor[2]},
> {xkoor[1],ykoor[3]},
> {xkoor[2],ykoor[3]},
> {xkoor[3],ykoor[3]},
> {xkoor[4],ykoor[3]}}
>
> and have no idea how to get this. So I would be very happy to get any
> small hint...
>
> Thanks a lot,
>
> Harald
>
>
>
Hi,
the easiest way is to copy the list from your question and.. ;-)
Here is another way:
With[{iend = 4, jend = 3},
Flatten[Table[{xkoord[i], ykoord[j]}, {j, jend}, {i, iend}], 1]
]
Peter