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: [mg125811] Re: ReplacePart, Multiple replacements in one time
  • From: Rodrigo Murta <murta at rodrigomurta.com>
  • Date: Tue, 3 Apr 2012 04:50:44 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jlbo41$47q$1@smc.vnet.net>

On Apr 2, 5:30 am, Andrey Demidov <andrey.demi... at gmail.com> wrote:
> 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]

Maybe like this?

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

best regards
Murta



  • Prev by Date: Re: ReplacePart, Multiple replacements in one time
  • Next by Date: Defining a value-specific ColorFunction for use in ListDensityPlot
  • Previous by thread: Re: ReplacePart, Multiple replacements in one time
  • Next by thread: Re: ReplacePart, Multiple replacements in one time