MathGroup Archive 2009

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

Search the Archive

Re: slots with 2 indexed array?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95597] Re: slots with 2 indexed array?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 22 Jan 2009 07:02:09 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <gl720c$c7u$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

Map[If[# >= 2048, # - 2048, # + 2048] &,sigs,{2}]

??

Regards
   Jens

wb at wavebounce.com wrote:
> First I produce some dummy data, 4000 of what I call signals, 1024 samples each.
> 
> sigs = Table[10 i + j, {i, 4000}, {j, 1024}];
> len = Length[sigs];
> 
> I'd like to modify these signals. The For statement below works. I can use a slot function on each of the sigs specified by i.
> 
> For[i = 1, i < len + 1, i++, 
>   sigs[[i]] = If[# >= 2048, # - 2048, # + 2048] & /@ sigs[[i]] ]
> 
> Surely there's a way to use slots on a double indexed array but I haven't found it yet.
> 
> If I try to let # represent every entry in sigs, the If statement isn't processed:
> 
> sigs = If[# >= 2048, # - 2048, # + 2048] & /@ sigs;
> 
> I tried Which that Help says uses HoldAll but that doesn't work either; Which[] still isn't evaluated.
> 
> I tried using #2 and ## instead of # but that doesn't work.  In reading about slot functions I haven't seen any examples using multi indexed arrays.
> 
> Could someone please give me a hint on how to pull this off? -- if this can be done with slots. Thanks.
> 


  • Prev by Date: message-driven function: more explanation
  • Next by Date: Re: Basic questions on list manipulation in the "Mathematica Way"
  • Previous by thread: Re: slots with 2 indexed array?
  • Next by thread: Re: slots with 2 indexed array?