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

MathGroup Archive 2012

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

Search the Archive

Re: ReplacePart, Multiple replacements in one time

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125807] Re: ReplacePart, Multiple replacements in one time
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Tue, 3 Apr 2012 04:49:20 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

I'm just wondering if it is possible to make n different replacements in one command?

Something like this:

>> a = {{1, 2}, {3, 4}}
>> ReplacePart[a, 1 -> a[[1]] * 2, 2 -> a[[2]] + 5]


a = {{1, 2}, {3, 4}}
ReplacePart[a, { {1, 1} -> a[[1, 1]]*2, {1, 2} -> a[[1, 2]] + 5}]

{{1, 2}, {3, 4}}

{{2, 7}, {3, 4}}

?


Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu






  • Prev by Date: Re: How do I stop Mathematica changing the format of fractions in Input cells?
  • Next by Date: Re: how can i get the Scatter chart
  • Previous by thread: Re: ReplacePart, Multiple replacements in one time
  • Next by thread: Re: ChartElements in BarChart doesn't plot negatives any ideas?