Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Transpose to multiple lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55769] Re: Transpose to multiple lists
  • From: "Valeri Astanoff" <astanoff at yahoo.fr>
  • Date: Wed, 6 Apr 2005 03:10:58 -0400 (EDT)
  • References: <d2tf20$qk8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Seems convenient to use MapIndexed.
Let me first reply to the second question
because the first question is just
a particular case of the second question:

In[1]:= lst = {{4,6,3},{6,8,7,3},{9,4}};

In[2]:= MapIndexed[{First[#2],#1}&,#]& /@ lst // Flatten[#,1]&

Out[2]= {{1,4},{2,6},{3,3},{1,6},{2,8},{3,7},{4,3},{1,9},{2,4}}


In[3]:= a = {3,6,3,2}; b = {9,8,7,6};

In[4]:= MapIndexed[{First[#2],#1}&,#]& /@ {a,b} // Flatten[#,1]&

Out[4]= {{1,3},{2,6},{3,3},{4,2},{1,9},{2,8},{3,7},{4,6}}


hth

Valeri


  • Prev by Date: Re: MultipleListPlot Prolem
  • Next by Date: Re: Need to be able to diff 2 pieces of text.
  • Previous by thread: Re: Transpose to multiple lists
  • Next by thread: Re: Transpose to multiple lists