Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Map vs. Table

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75400] Re: Map vs. Table
  • From: dkr <dkrjeg at gmail.com>
  • Date: Sat, 28 Apr 2007 05:58:33 -0400 (EDT)
  • References: <f0sfrs$ncb$1@smc.vnet.net>

Istvan,

In[14]:=
data = Table[i*j, {i, 5}, {j, 10}];

In[15]:=
Table[{i,#}&/@data[[i]],{i,Length[data]}];

Your example suggests that you want to give the same label to each
integer in a given row of data.  If so, then one alternative is:

In[16]:=
Thread[{#,data[[#]]}]&/@Range[Length[data]]

Out[16]=
{{{1,1},{1,2},{1,3},{1,4},{1,5},{1,6},{1,7},{1,8},{
    1,9},{1,10}},{{2,2},{2,4},{2,6},{2,8},{2,10},{2,12},{2,14},{
    2,16},{2,18},{2,20}},{{3,3},{3,6},{3,9},{3,12},{3,15},{
    3,18},{3,21},{3,24},{3,27},{3,30}},{{4,
    4},{4,8},{4,12},{4,16},{4,20},{4,24},{4,28},{4,32},{4,36},{
  4,40}},{{5,5},{5,10},{5,15},{5,20},{5,25},{5,30},{5,35},{5,40},{5,
    45},{5,50}}}

In[17]:=
%16===%15

Out[17]=
True

dkr




  • Prev by Date: Finding cardinality of set based on random selection from set
  • Next by Date: Re: Map vs. Table
  • Previous by thread: Map vs. Table
  • Next by thread: Re: Map vs. Table