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

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

Search the Archive

Re: MapThread

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57030] Re: [mg56998] MapThread
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Thu, 12 May 2005 03:53:10 -0400 (EDT)
  • References: <200505120632.CAA08872@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 12 May 2005, at 15:32, Swati Shah wrote:

>
> 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


The simplest way to do what (I think) you are trying to do is


states[[Range[3,12,2]]]=stim;


states

{1,2,33,4,44,6,55,8,66,10,77,12,13,14}


Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/andrzej/index.html
http://www.mimuw.edu.pl/~akoz/


  • References:
    • MapThread
      • From: Swati Shah <swatshah@gmail.com>
  • Prev by Date: Re: ok. How to resolve?
  • Next by Date: Re: ChineseRemainder
  • Previous by thread: MapThread
  • Next by thread: Re: MapThread