slots with 2 indexed array?
- To: mathgroup at smc.vnet.net
- Subject: [mg95553] slots with 2 indexed array?
- From: "wb at wavebounce.com" <wb at wavebounce.com>
- Date: Wed, 21 Jan 2009 06:47:42 -0500 (EST)
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.