Re: slots with 2 indexed array?

• To: mathgroup at smc.vnet.net
• Subject: [mg95599] Re: slots with 2 indexed array?
• From: dh <dh at metrohm.com>
• Date: Thu, 22 Jan 2009 07:02:31 -0500 (EST)
• References: <gl720c\$c7u\$1@smc.vnet.net>

```
Hi,

mathematica is clever enough to figure which slot belongs to which function:

If[# >= 2, # - 2, # + 2] & /@ # & /@ sig

hope this helps, Daniel

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: Re: Fitting problem
• Next by Date: Re: Problem with an integral
• Previous by thread: slots with 2 indexed array?
• Next by thread: Re: slots with 2 indexed array?