Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Replace elements in structured list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99064] Re: Replace elements in structured list
  • From: replicatorzed at gmail.com
  • Date: Sun, 26 Apr 2009 01:36:34 -0400 (EDT)
  • References: <gsuivb$duh$1@smc.vnet.net>

Never mind, I've found the answer at -1:


In[4]:= data = {{1, {2, 2, 2, 2}, {2, 2, 2, 2},
    1}, {1, {2, 2, 2, 2}, {2, 2, 2, 2}, 1}};

c = 1;

Replace[data, _?NumberQ :> c++, {-1, \[Infinity]}]

Out[6]= {{1, {2, 3, 4, 5}, {6, 7, 8, 9},
  10}, {11, {12, 13, 14, 15}, {16, 17, 18, 19}, 20}}


  • Prev by Date: Re: Mathematica JLink and comm.javax.CommPortIdentifier
  • Next by Date: Re: Position problem
  • Previous by thread: Re: Replace elements in structured list
  • Next by thread: Re: Replace elements in structured list