Re: {x},{y} -> {x,y} ?
- To: mathgroup at smc.vnet.net
- Subject: [mg68272] Re: {x},{y} -> {x,y} ?
- From: "David Reiss" <dbreiss at gmail.com>
- Date: Mon, 31 Jul 2006 03:45:39 -0400 (EDT)
- References: <eaht5b$or5$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Assuming that Length[xValues] is the same as Length[yValues] then Transpose[{xValues, yValues}] is one way to do this. Here is another way: MapThread[{#1, #2} &, {xValues, yValues}, 1] The Transpose way appears to be faster by about a factor of 20: In[1]:= xValues=Table[Random[],{100000}]; yValues=Table[Random[],{100000}]; In[3]:= MapThread[{#1,#2}&,{xValues,yValues},1];//Timing Out[3]= {0.163283 Second,Null} In[4]:= Transpose[{xValues,yValues}];//Timing Out[4]= {0.007408 Second,Null} AngleWyrm wrote: > Hi, > I have two lists, a set of x values and a set of y values. How do I convert > them to one list of { {x1,y1},{x2,y2} } pairs?