Re: Assigning values to a list.
- To: mathgroup at smc.vnet.net
- Subject: [mg110101] Re: Assigning values to a list.
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 1 Jun 2010 07:41:58 -0400 (EDT)
Use either Thread or Transpose
x = {1, 3, 5};
y = {2, 4, 6};
z = Thread[{x, y}]
{{1, 2}, {3, 4}, {5, 6}}
z = Transpose[{x, y}]
{{1, 2}, {3, 4}, {5, 6}}
Bob Hanlon
---- kevin <kevin999koshy at gmail.com> wrote:
=============
Hi Guys,
I am a newbie to mathematica..Is there anyway to read
values from 2 lists {n by 1} and {n by 1} to a new list {n by 2}
without using loops.. eg say you have x = {1,3,5} any y = {2,4,6}, I
will need a new list z ={{1,2},{3,4},{5,6}}.. Thanks in advance.