Re: MapThread
- To: mathgroup at smc.vnet.net
- Subject: [mg57038] Re: [mg56998] MapThread
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 12 May 2005 22:44:20 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
states={1,2,3,4,5,6,7,8,9,10,11,12,13,14}; stim={33,44,55,66,77}; MapThread[(states[[#1]]=#2)&, {Range[3,11,2],stim}]; states {1,2,33,4,44,6,55,8,66,10,77,12,13,14} Bob Hanlon > > From: Swati Shah <swatshah at gmail.com> To: mathgroup at smc.vnet.net > Date: 2005/05/12 Thu AM 02:32:41 EDT > Subject: [mg57038] [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 > >