MathGroup Archive 2005

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

Search the Archive

Re: MapThread

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57031] Re: [mg56998] MapThread
  • From: "Caffa Vittorio Dr." <Caffa at iabg.de>
  • Date: Thu, 12 May 2005 03:53:12 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Try this:


In[1]:= states = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};

In[2]:= stim = {33, 44, 55, 66, 77};

In[3]:= ilist = Range[3, 12, 2]

Out[3]= {3, 5, 7, 9, 11}

In[4]:= states[[ilist]] = {33, 44, 55, 66, 77};

In[5]:= states

Out[5]= {1, 2, 33, 4, 44, 6, 55, 8, 66, 10, 77, 12, 13, 14}


Cheers, Vittorio

>-----Original Message-----
>From: Swati Shah [mailto:swatshah at gmail.com]
To: mathgroup at smc.vnet.net
>Sent: Thursday, May 12, 2005 8:33 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg57031] [mg56998] MapThread
>
>Hi Everyone,
>
>I have been working on the following problem:
>
>states = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}
>
>stim = {33, 44, 55, 66, 77}
>
>
>The locations of state 3,5,7,9,11 to be equal 33,44,55,66,77
>
>MapThread[{#1 = #2} &, {Take [states, {3, 12, 2}], stim}]
>
>I tried to the above but it gives me errors:
>Set::setraw: Cannot assign to raw object 3
>
>However these work individually:
>MapThread[#1 &, {Take [states, {3, 12, 2}], stim}]
>MapThread[ #2 &, {Take [states, {3, 12, 2}], stim}]
>
>Any ideas?
>
>Thanks in advance


  • Prev by Date: Re: ChineseRemainder
  • Next by Date: Re: More problems with SetPrecision[] and/or $MinPrecision,...
  • Previous by thread: Re: MapThread
  • Next by thread: Re: MapThread