Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*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 1998

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

Search the Archive

Re: ReplacePart?


  • To: mathgroup@smc.vnet.net
  • Subject: [mg10580] Re: [mg10480] ReplacePart?
  • From: "Dr. Tomás Garza"@smc.vnet.net
  • Date: Tue, 20 Jan 1998 16:54:19 -0500

Scott,
Try this:

gt={{3,5},{{},6},{7,{}},{{},{}},{{},56},{{},3}};

b={a1,a2,a3,a4,a5,a6};

c=Position[gt,{},2]

    {{2,1}, {3,2}, {4,1}, {4,2}, {5,1}, {6,1}}


f{h_List, k_Integer] := ReplacePart[h, b[[k]], c[[k]]];


Fold[f, gt, {1,2,3,4,5,6}]
  
   {{3,5}, {a1,6}, {7,a2}, {a3,a4}, {a5,56}, {a6,3}}

Good luck,

Tomas Garza
Mexico City



  • Prev by Date: Importing formulas in Word with acceptable display & printing resolution
  • Next by Date: LINUX vs MATHEMATICA
  • Prev by thread: Re: ReplacePart?
  • Next by thread: Re: ReplacePart?